Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/auto-merge-compatibility-docs.yml
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:
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
- 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 }}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 develop<>stable

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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

28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,31 @@ jobs:
# codecov --flags integration-tests
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# ------------------------------------------ Gate ------------------------------------------
# Single rollup check, so branch protection can require CI without naming every
# job (several are conditional, and unit-tests fans out over a moving matrix).
ci-gate:
name: ci-gate
if: always()
needs:
- prepare-environment
- files-changed
- yaml-lint
- python-lint
- markdown-lint
- action-lint
- uv-lock-check
- documentation
- validate-generated-documentation
- validate-documentation-style
- unit-tests
- integration-tests-latest-infrahub
runs-on: "ubuntu-latest"
timeout-minutes: 5
steps:
- name: "Fail if any job did not succeed or skip"
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "One or more CI jobs failed or were cancelled."
exit 1