Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: integrate npm-lockfile-changes action #846

Merged
merged 10 commits into from
Sep 19, 2024
Merged

Conversation

achou11
Copy link
Member

@achou11 achou11 commented Sep 19, 2024

Uses a fork (https://github.com/rvanvelzen/npm-lockfile-changes) of the original action (https://github.com/codepunkt/npm-lockfile-changes) because the original does not seem to work with v3 lockfiles.

Uses the action's default values for inputs for now (https://github.com/marketplace/actions/npm-lockfile-changes#-inputs)

Also omits the permissions configuration since we don't use dependabot (https://github.com/marketplace/actions/npm-lockfile-changes#the-action-fails-on-the-dependabot-pull-requests). My understanding is that we don't need to specify as a result, but could be wrong.

Out of scope, but also updated this workflow to only run when the pull request changes the package-lock.json file, as opposed to anytime a pull request is opened. Happy to revert if not desired.

Comment on lines +2 to +5
on:
pull_request:
paths:
- 'package-lock.json'
Copy link
Member Author

Choose a reason for hiding this comment

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

highlighting this since it's kind of out of scope for the PR and could be reverted if not desired. Figured it would be worth doing to save a few CPU cycles though 😄

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with including this.

Copy link
Member

@gmaclennan gmaclennan left a comment

Choose a reason for hiding this comment

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

Looks good, however as a post-merge-task I think we should setup a Github app for this and generate a token, see https://github.com/digidem/release-automations/blob/7eddab75ddec8324c17d532ae3b96bbd60182c60/.github/workflows/build-rc.yml#L62-L67 - we can create a new Github App for this workflow. This gives more refined control over permissions, and controls the name and icon of the actor creating the comments on the PR.

uses: actions/checkout@v4
- name: NPM Lockfile Changes
# The original doesn't support v3 lockfiles so we use a fork that adds support for them
uses: rvanvelzen/npm-lockfile-changes@main
Copy link
Member

Choose a reason for hiding this comment

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

For the sake of security, maybe pin to a specific commit?

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed via 6a77584

Comment on lines +2 to +5
on:
pull_request:
paths:
- 'package-lock.json'
Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with including this.

@achou11
Copy link
Member Author

achou11 commented Sep 19, 2024

Looks good, however as a post-merge-task I think we should setup a Github app for this and generate a token, see https://github.com/digidem/release-automations/blob/7eddab75ddec8324c17d532ae3b96bbd60182c60/.github/workflows/build-rc.yml#L62-L67 - we can create a new Github App for this workflow. This gives more refined control over permissions, and controls the name and icon of the actor creating the comments on the PR.

Addressed with Gregor's help and code changes in f9a0c06

@gmaclennan
Copy link
Member

Seems like the action is failing, not clear why

@achou11
Copy link
Member Author

achou11 commented Sep 19, 2024

Seems like the action is failing, not clear why

Where are you seeing this? Wouldn't expect this to run on this PR due to the change related to only running based on the lockfile changing

@achou11
Copy link
Member Author

achou11 commented Sep 19, 2024

@gmaclennan see the example of the integration working in #853

@achou11 achou11 merged commit 7b1828b into main Sep 19, 2024
6 checks passed
@achou11 achou11 deleted the ac/lockfile-changes-ci branch September 19, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants