-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Introduce reusable workflow to update pre-commit
hooks
#6
Conversation
98a07e7
to
4878154
Compare
pre-commit
hooks
0b9d028
to
77c7ca6
Compare
f666f4e
to
7459b0f
Compare
7459b0f
to
b7c8ed7
Compare
Ok....so, experimenting with the updates to the So, I'm going to create PRs just to accommodate the rename of the dependabot changenote workflow. This PR probably should not be merged until those PRs are ready to be merged.....or we're gonna break all the dependabot change note workflows. |
I created the related PRs to handle the rename of the changenote workflow. This PR (and all those) can now be safely merged. The effort to introduce |
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 is some dark magicks... nice work :-)
A couple of high level questions/ideas:
-
Should the pre-commit-update workflow include the change note, rather than requiring a second pass of the changenote workflow to add one (possibly controlled by an input if there are any repos that have precommit but don't have towncrier)? That would seem to avoid the duplicate pass problem, as the dependabot change note would only trigger on commits authored by dependabot, and the pre-commit workflow would be authored by brutus and include a changenote.
-
I presume this has been triggered manually as a result of the workflow_dispatch registration in the briefcase-test-1? In practice, this would be replaced with a schedule-cron workflow, correct?
-
It looks like the if the pre-commit update doesn't discover any changes (i.e., the normal case), the workflow fails - won't this result in a weekly "nothing changed" email because of the failed workflow? Could this be replaced with some logic that catches the $? return value, and sets a "needed=False" flag that is used by the "Create PR" step?
But then we won't have workflow after workflow triggering each other ;) this definitely makes more sense.
Yep; the
I actually tested the case where nothing changes and therefore there's nothing to commit. In that case, the |
1f35ff7
to
3c16f33
Compare
3c16f33
to
3a8eb3a
Compare
Removed depenabot changenote workflow changes from scope and updated |
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 think this all makes sense, and the demo repo seems to indicate it works in practice, so I guess we'll go with it!
I've also added the BRUTUS_PAT_TOKEN as an organization-wide secret.
Changes
pre-commit
hooks.🔴 Required Updates 🔴
BRUTUS_PAT_TOKEN
token needs to added as a "normal" organizational secret as well.Workflow Implementation
pre-commit
(from the repo'sdev
extra by default or using the input)pre-commit
and run its autoupdatepre-commit
with the updated hookspeter-evans/create-pull-request
action, commit all changed files to a branch calledautoupdates/pre-commit
and add to a PRIt probably makes the most sense for repos to run this alongside dependabot on Sunday nights. Each time the workflow run, it effectively resets the
autoupdates/pre-commit
branch....so beware making changes to one of these PRs and letting it sit over the weekend.The author of the PR that's created is controlled by the user behind the token used (I think).
Example PR: https://github.com/rmartin16/briefcase-test-1/pull/42
Example pre-commit run: https://github.com/rmartin16/briefcase-test-1/actions/runs/4060193182/jobs/6989040382
Example with nothing to update: https://github.com/rmartin16/briefcase--test-2/actions/runs/4060240083/jobs/6989131369
Example demonstrating inputs: https://github.com/rmartin16/briefcase--test-2/actions/runs/4060271416/jobs/6989193718
PR Checklist: