-
Notifications
You must be signed in to change notification settings - Fork 347
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
Enable dependabot automatic updates #630
Enable dependabot automatic updates #630
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice. Thanks for working this out. I just have a few comments but nothing major at all.
BRANCH: '${{ github.head_ref }}' | ||
run: | | ||
git fetch | ||
git checkout $BRANCH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this works. I thought you'd have to add fetch-depth: 0
to the actions/checkout
call, otherwise it makes a shallow checkout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works and was previously necessary when I had just git push
because unlike the actions/checkout
call which checks out a detached HEAD
the above actually checks out the branch and lets us push to it. Now that we've specified the branch in push
I think we could use actions/checkout
but I think leaving this is also okay (and might avoid someone confusion in the future about why just push
doesn't work if they ever change it back).
run: | | ||
git fetch | ||
git checkout $BRANCH | ||
sudo npm install --force -g npm@latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an open question of is using latest better than using what's on the actions VMs. They come with something pretty modern anyway, and it may be more stable than going with the latest. Although I assume this is still the latest released version and not true bleeding edge, so it's probably fine either way.
Whatever we do here, it should match the NPM version used in https://github.com/github/codeql-action/blob/main/.github/workflows/pr-checks.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually unfortunately necessary because the version in the Actions VM is old enough that it uses v1 of the lockfile and cannot do npm install
correctly with the v2 lockfile that is checked in. This isn't necessary for the PR checks there because they do not actually do npm install
and the other npm
commands are forwards-compatible with the new lockfiles, but I agree for consistency we should probably use the same version there - I will update this. Indeed @latest
is the latest stable release rather than the bleeding edge pre-release version which is @next
.
59d75eb
to
6b12388
Compare
6b12388
to
934fb86
Compare
I'm a little surprised the workflow didn't run on this PR since I added the Update dependencies label. Any ideas why it wouldn't be working @robertbrignull? Does the |
Quite likely. The idea is that it runs the version of the workflow from the base branch to avoid the PR being able to change the workflow. |
Makes sense. Guess we can't test the updated workflow then, but since it hasn't changed too much from my first commit I'm sure it will be okay. |
Probably the best way would be to push another branch with a slightly altered workflow that does run on PRs, or test it in a totally separate respository. Both of those options can be a bit of effort though. There's not too much risk here as the worst that can happen is that the workflow just doesn't work. |
Given the low risk, I suggest we just wait and see if it works on Thursday. I tested my original commit and not that much has changed since it. Plus, testing it as you suggest while useful still wouldn't test some of the specifics of what happens when Dependabot opens the PR rather than me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for responding quickly to all the comments. I think this LGTM now. As you say, there's pretty low risk for this so we can just try it out.
Closes https://github.com/github/codeql-coreql-team/issues/1344
This adds a new workflow (triggered by a label) that updates the checked-in dependencies on a PR branch. It also enables Dependabot and has it apply the relevant label to have the checked-in dependencies updated. Unfortunately, the workflow will not work on forks due to missing the permissions to push to other user's forks, so we can't use it on our own PRs. It should work on Dependabot's PRs, though, since it creates its PRs from the main repo.