-
Notifications
You must be signed in to change notification settings - Fork 12
ci: auto-merge compatibility matrix PRs once CI is green #1217
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
base: stable
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| --- | ||
| # yamllint disable rule:truthy rule:line-length | ||
| name: "Auto-merge compatibility matrix updates" | ||
|
|
||
| # The compatibility matrix PR is generated by the Infrahub release pipeline and | ||
| # contains nothing but regenerated docs, so it merges itself once CI is green. | ||
| # Waiting for CI is enforced by the `ci-gate` required status check on `stable`, | ||
| # not by this workflow. | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize | ||
| # Auto-merge cannot be enabled on a draft, so re-evaluate on the transition out of one. | ||
| - ready_for_review | ||
|
|
||
| jobs: | ||
| enable-auto-merge: | ||
| if: | | ||
| github.event.pull_request.head.repo.full_name == github.repository && | ||
| github.event.pull_request.head.ref == 'automated/update-compatibility-docs' && | ||
| github.event.pull_request.base.ref == 'stable' && | ||
| github.event.pull_request.user.login == 'opsmill-bot' && | ||
| github.event.pull_request.draft == false | ||
| runs-on: "ubuntu-latest" | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - name: "Enable auto-merge" | ||
| # Authenticate as opsmill-bot: it is the identity allowed to bypass the | ||
| # approval requirement on `stable`, and auto-merge merges as whoever enabled it. | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GH_UPDATE_PACKAGE_OTTO }} | ||
| run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bit tricky. Because we don't have required CI checks, basically a PR is eligible to be merged the moment it is opened. Therefore the --auto flag would merge it instantly. How we've overcome this is by using custom checks in the infrahub-github-bot https://github.com/opsmill/infrahub-github-bot/blob/main/core/pr_helper.py#L46, for the sync between However, the release pipeline can't have a failing CI that will be raised during this phase, so in short term we could even do that although it's not 100% correct. @fatih-acar wdyt?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's safe for such documentation changes Anyway I was reluctant to get that PR in (I'd like us to move forward with infrahub-github-bot to remove the repository dispatch automations we have...) but since it's already there... lgtm to merge but keep in mind we'll remove this change asap |
||
Uh oh!
There was an error while loading. Please reload this page.