Skip to content

fix(ci): unblock docs-sync and release-please from CodeQL gate#101

Merged
nsalvacao merged 2 commits into
mainfrom
fix/ci-docs-sync-and-release
Apr 15, 2026
Merged

fix(ci): unblock docs-sync and release-please from CodeQL gate#101
nsalvacao merged 2 commits into
mainfrom
fix/ci-docs-sync-and-release

Conversation

@nsalvacao

Copy link
Copy Markdown
Owner

Summary

Two CI workflows were failing after every merge to main due to a branch protection ruleset that applied to ALL branches (~ALL) and required CodeQL results before any push — creating circular dependencies.

Root causes

Docs Syncgit-auto-commit-action pushed directly to main. The CodeQL branch protection rule blocks the push until CodeQL has run on that commit, but CodeQL can only run after the push. Circular dependency, not solvable without changing the architecture.

Releaserelease-please-action updates refs/heads/release-please--branches--main (its internal tracking branch). The ruleset's ~ALL condition applied CodeQL gate to ALL branches, including this release-please branch — making it impossible for release-please to function.

Fixes applied

Ruleset change (applied directly via GitHub API):

  • Removed ~ALL from ruleset conditions — keeps only ~DEFAULT_BRANCH
  • The CodeQL gate now only applies to main, not to every branch in the repo
  • Unblocks release-please from managing refs/heads/release-please--branches--main

docs-sync.yml workflow change (this PR):

  • Replaced git-auto-commit-action direct push with a PR-based approach
  • Workflow creates a short-lived branch chore/docs-sync-<run_id>, commits, opens a PR, and enables auto-merge
  • CodeQL runs on the PR branch, then auto-merge completes when checks pass
  • No infinite loop: trigger paths (plugins/**, .claude-plugin/marketplace.json, scripts/sync-docs.py) don't include README.md or docs/ — merged commit won't re-trigger docs-sync

Test plan

  • Merge this PR and confirm CodeQL passes on the PR branch
  • Trigger workflow_dispatch on Docs Sync and verify it creates a PR with auto-merge
  • Trigger a push to main that touches plugins/** and verify the full cycle completes
  • Verify Release workflow passes on the next merge to main

🤖 Generated with Claude Code

- Replace direct push to main with PR-based approach
- git-auto-commit-action pushed directly to main, which was blocked by
  the CodeQL branch protection rule (circular dependency: CodeQL runs
  after push, but push requires CodeQL results)
- New approach: create a short-lived branch, commit, open PR with
  auto-merge enabled, and let CodeQL pass on the PR before merging
- No infinite loop risk: trigger paths (plugins/**, marketplace.json)
  don't include README.md or docs/ — so the merged commit won't
  re-trigger docs-sync
- Adds pull-requests: write permission required for gh pr create

Also: ruleset updated via API to remove ~ALL from conditions,
keeping only ~DEFAULT_BRANCH — this unblocks release-please from
updating refs/heads/release-please--branches--main.

Generated by Nuno Salvação <nuno.salvacao@gmail.com> & Co-Authored with: Nexo <nexo.modeling@gmail.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

Copilot AI left a comment

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.

Pull request overview

Updates the Docs Sync CI workflow to avoid direct pushes to main (which were blocked by CodeQL branch protection), by switching to a PR-based docs update flow.

Changes:

  • Added pull-requests: write permission for the docs-sync job.
  • Replaced direct auto-commit to main with: detect changes → create branch → push → open PR → enable auto-merge.

Comment thread .github/workflows/docs-sync.yml Outdated
Comment thread .github/workflows/docs-sync.yml Outdated
- Include run_attempt in branch name (run_id-run_attempt) so each
  attempt gets a unique ref — prevents non-fast-forward push failure
  on reruns of the same workflow run (R1)
- Switch git checkout -b to -B (force) to handle any residual branch
  from a failed prior step cleanly (R2)
- Capture PR number after creation and use it for gh pr merge instead
  of branch-name resolution; add idempotent lookup so partial failures
  (push OK, pr create failed) re-use the existing PR on retry (R2)

Generated by Nuno Salvação <nuno.salvacao@gmail.com> & Co-Authored with: Nexo <nexo.modeling@gmail.com>
@nsalvacao

Copy link
Copy Markdown
Owner Author
Review item Decision Technical rationale
[R1] Branch name uses only run_id — non-idempotent on rerun (Copilot inline, line 64) Accepted run_id is unique per run but reruns increment run_attempt; added -${{ github.run_attempt }} suffix so each attempt gets a unique ref. Prevents non-fast-forward push failures. Implemented.
[R2] PR creation/merge not robust on partial failure (Copilot inline, line 65-76) Accepted with adaptation If push succeeds but gh pr create fails mid-run, a rerun would attempt to create a PR for a branch that already exists. Fix: git checkout -B (force-reset existing branch), capture PR_NUMBER via gh pr view lookup before create, use number for gh pr merge. Copilot suggestion adopted; gh pr edit on existing PR omitted (branch is already unique per attempt, so reuse path is edge-case only). Implemented.
[CI1] Plugin Validation No action needed Passed on both commits. No workflow or plugin files changed.
[CI2] Security (OpenSSF Scorecard + CodeQL Python) No action needed Passed on both commits. Python files unchanged; YAML-only diff has no CodeQL findings.
[CI3] CodeQL (Copilot Advanced Security) No action needed Passed on both commits.
[CI4] GitGuardian Security Checks No action needed Passed on both commits. No secrets or credentials in diff.

@nsalvacao nsalvacao merged commit bc5b145 into main Apr 15, 2026
5 checks passed
@nsalvacao nsalvacao deleted the fix/ci-docs-sync-and-release branch April 15, 2026 10:14
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