Skip to content

Conversation

@lym953
Copy link
Contributor

@lym953 lym953 commented Nov 21, 2024

Motivation

The GitHub Action added in #540 failed to publish the npm package on release event. GitHub Action log says

error No token found and can't prompt for login when running with --non-interactive.

What does this PR do?

Change the way to set npm publish token, following this discussion:
actions/setup-node#81 (comment)

Testing Guidelines

Steps

  1. Add this to publish.yml
on:
  release:
    types: [created]
+ push:
  1. Push the commit

Result

The previous error is gone, and a new error appears:

Couldn't publish package: "https://registry.npmjs.org/serverless-plugin-datadog: You cannot publish over the previously published versions: 5.74.0."

I think we can assume it's a success.

GitHub Action log

Additional Notes

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

@lym953 lym953 requested a review from a team as a code owner November 21, 2024 19:49
Copy link
Contributor

@purple4reina purple4reina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, actually on second thought, I feel a bit uneasy about writing a secret to disk like this. Can we add a step that will remove the npmrc file? Make sure it executes on success and failure?

@lym953 lym953 force-pushed the yiming.luo/github-action-npm-2 branch 2 times, most recently from b28d072 to be47e3b Compare November 21, 2024 20:06
@lym953 lym953 force-pushed the yiming.luo/github-action-npm-2 branch from be47e3b to 40ee717 Compare November 21, 2024 20:07
@lym953
Copy link
Contributor Author

lym953 commented Nov 21, 2024

@purple4reina I changed to another approach mentioned in another comment, which looks more secure.

@lym953 lym953 requested a review from purple4reina November 21, 2024 20:12
Copy link
Contributor

@purple4reina purple4reina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it

@lym953
Copy link
Contributor Author

lym953 commented Nov 21, 2024

/merge

@dd-devflow
Copy link

dd-devflow bot commented Nov 21, 2024

Devflow running: /merge

View all feedbacks in Devflow UI.


2024-11-21 20:29:54 UTC ℹ️ MergeQueue: pull request added to the queue

The median merge time in main is 2m.

@dd-mergequeue dd-mergequeue bot merged commit 1bd5ee1 into main Nov 21, 2024
10 checks passed
@dd-mergequeue dd-mergequeue bot deleted the yiming.luo/github-action-npm-2 branch November 21, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants