Skip to content

Auto-recompile gh-aw lock files on Dependabot PRs#114

Open
theletterf wants to merge 5 commits intomainfrom
fab/recompile-gh-aw-on-bump
Open

Auto-recompile gh-aw lock files on Dependabot PRs#114
theletterf wants to merge 5 commits intomainfrom
fab/recompile-gh-aw-on-bump

Conversation

@theletterf
Copy link
Copy Markdown
Member

@theletterf theletterf commented Apr 27, 2026

Summary

  • Adds .github/workflows/recompile-aw-on-bump.yml. On any Dependabot PR that touches .github/workflows/gh-aw-*.lock.yml, it installs the pinned gh-aw (v0.71.1), runs gh aw compile, and pushes the result back to the Dependabot branch.
  • Triggers on pull_request and gates with if: github.actor == 'dependabot[bot]'. Dependabot branches are same-origin so checkout/push work, and workflow-level permissions: declarations are honored on Dependabot pull_request runs (so id-token: write for the OIDC token still works).
  • Pushes via the existing elastic/oblt-actions/github/create-token ephemeral token (same one check-aw-updates.yml uses), so downstream status checks re-run after the fixup commit.

Why

Dependabot pins actions to commit SHAs (e.g. actions/github-script@3a2844b…), but gh aw compile resolves the same v9 tag to its annotated tag object SHA (373c709c…). They disagree, so every Dependabot bump that lands inside the gh-aw lock files trips the compile-workflows pre-commit hook. We hit this on #112 and will keep hitting it. This workflow makes the fix automatic instead of manual.

Test plan

  • After merge, watch the next Dependabot github-actions PR: confirm a follow-up commit "Recompile gh-aw lock files after Dependabot bump" appears and pre-commit passes.
  • Optional dry-run: trigger by pushing a no-op SHA edit on a Dependabot branch and verify the workflow runs and is a no-op (Lock files already match a fresh compile).

🤖 Generated with Claude Code

Dependabot pins actions to commit SHAs, but `gh aw compile` resolves tags to annotated-tag-object SHAs. The two disagree on actions like actions/github-script, so every Dependabot bump touching gh-aw lock files fails the pre-commit hook. This workflow runs on those PRs, recompiles, and pushes the result back to the Dependabot branch using an ephemeral oblt token so downstream checks re-run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@theletterf theletterf requested a review from a team as a code owner April 27, 2026 08:10
@theletterf theletterf requested a review from reakaleek April 27, 2026 08:10
@theletterf theletterf self-assigned this Apr 27, 2026
@theletterf theletterf added the enhancement New feature or request label Apr 27, 2026
@theletterf
Copy link
Copy Markdown
Member Author

@reakaleek @Mpdreamz This should avoid Dependabot PRs getting stuck on AW lock files.

Comment thread .github/workflows/recompile-aw-on-bump.yml Outdated
theletterf and others added 4 commits April 27, 2026 11:06
Dependabot branches are same-origin, so pull_request handles the trigger and checkout fine. Declared permissions are still honored on Dependabot pull_request runs, so id-token: write works for the OIDC token. Avoids the pull_request_target footgun.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Prevent the docs-review agent from offering apply-ready GitHub suggestions when Elastic substitution syntax could be escaped by safe-output sanitization.

Co-authored-by: GPT-5.5 <gpt-5.5@users.noreply.github.com>
Made-with: Cursor
Keep this existing PR focused on its original workflow trigger changes now that the docs-review mitigation has a separate PR.

Co-authored-by: GPT-5.5 <gpt-5.5@users.noreply.github.com>
Made-with: Cursor
@theletterf theletterf requested a review from Mpdreamz April 28, 2026 07:00
id: create-token
uses: elastic/oblt-actions/github/create-token@v1.38.1
with:
token-policy: token-policy-8749eaab83f2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this require a new policy? this is reusing a token which is bound to a different workflow ref?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right — checked the policy in catalog-info. It's bound to a single workflow_ref:

bound_claims:
  workflow_ref: elastic/docs-actions/.github/workflows/check-aw-updates.yml@refs/heads/main

So this workflow gets rejected on two counts:

  1. Wrong workflow file (recompile-aw-on-bump.ymlcheck-aw-updates.yml).
  2. Trigger is pull_request, so workflow_ref will be …@refs/pull/N/merge, not …@refs/heads/main.

I'll hold this PR until I can open a catalog-info PR to broaden the binding — either a list of allowed refs or a glob covering both workflows and refs/pull/*/merge. Open to a different approach if you'd prefer not to widen this policy (e.g., a separate policy just for this workflow, or a Dependabot-secret PAT). What's your preference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants