Skip to content

feat(update-copilot-skills): optional App token so update PRs trigger CI#240

Merged
botantler[bot] merged 3 commits into
mainfrom
claude/ci-update-skills-app-token
May 26, 2026
Merged

feat(update-copilot-skills): optional App token so update PRs trigger CI#240
botantler[bot] merged 3 commits into
mainfrom
claude/ci-update-skills-app-token

Conversation

@devantler
Copy link
Copy Markdown
Contributor

🤖 Generated by the Daily AI Assistant

Problem

Skills-sync PRs opened by this reusable workflow never trigger the caller's CI, so their required checks never report and the PR stays permanently BLOCKED. Root cause: the workflow creates the PR with the default GITHUB_TOKEN, and GitHub suppresses on: pull_request/push events for PRs made with GITHUB_TOKEN (recursion guard). The caller's CI (which posts the required check) therefore never runs.

Observed on plugins #9 (2026-05-26): created by github-actions[bot] via GITHUB_TOKEN; CodeQL/Analyze ran (code-scanning default setup) but CI - Required Checks was missing → BLOCKED. The manual unblock was close+reopen with a user token; this makes it durable.

Fix (backward-compatible, opt-in)

Add an optional App-token path, mirroring the existing sync-cluster-policies.yaml convention in this repo:

  • New input use-app-token (boolean, default false).
  • New optional secret APP_PRIVATE_KEY.
  • When use-app-token: true, mint a token via actions/create-github-app-token (app-id: vars.APP_ID, private-key: secrets.APP_PRIVATE_KEY) and pass it to checkout and peter-evans/create-pull-request (token + branch-token). PRs created with an App token DO trigger the caller's CI.
  • The ${{ steps.app-token.outputs.token || github.token }} fallback preserves current behaviour when use-app-token is false.

No caller breaks: all 4 callers (ksail, plugins, platform, this repo's CI dry-run) keep working unchanged; the App-token path is strictly opt-in.

Kept app-id: vars.APP_ID to match the org's existing sync-cluster-policies.yaml (create-github-app-token now prefers client-id, but that's a separate org-wide migration).

Follow-up (after this merges + a release is cut)

Bump the plugins caller (devantler-tech/plugins/.github/workflows/update-copilot-skills.yaml, currently pinned @v3.2.0) to the new version and set use-app-token: true + secrets: APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}. Then skills-sync PRs trigger CI on their own and plugins' 🔀 Enable Auto-Merge finishes them.

Validation

actionlint passes locally; YAML parses clean. ⚠️ GitHub Actions is in a major outage right now ("Incident with Actions and Pages"), so the runtime trigger behaviour can't be confirmed yet. Opened as a draft — validate against a real skills-sync run once Actions recovers before promoting/merging.

Copilot AI review requested due to automatic review settings May 26, 2026 12:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the reusable update-copilot-skills workflow to optionally create PRs using a GitHub App token so that downstream on: pull_request / on: push CI workflows in the caller repository are triggered (avoiding permanently blocked PRs due to required checks never running).

Changes:

  • Added an opt-in use-app-token input plus APP_PRIVATE_KEY workflow secret for minting a GitHub App installation token.
  • Added a token-generation step via actions/create-github-app-token.
  • Routed the minted token (with fallback to github.token) into actions/checkout and peter-evans/create-pull-request (token + branch-token).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/update-copilot-skills.yaml
Comment thread .github/workflows/update-copilot-skills.yaml
@devantler devantler marked this pull request as ready for review May 26, 2026 12:39
Comment thread .github/workflows/update-copilot-skills.yaml Fixed
Set persist-credentials: false on checkout so the (now possibly App)
token isn't left in the local git config for later steps. PR creation
uses peter-evans/create-pull-request with its own token/branch-token,
and the skills-update step uses gh via env — nothing downstream needs
persisted git credentials. Matches sync-cluster-policies.yaml.

Addresses Copilot review on #240.
@botantler botantler Bot enabled auto-merge (squash) May 26, 2026 13:18
Add permission-contents: write + permission-pull-requests: write to the
create-github-app-token step so the minted token is scoped to exactly
what the job needs, instead of inheriting the App installation's blanket
permissions (zizmor github-app finding). Resolves the new code-scanning
alert this PR would otherwise introduce.
Copilot AI review requested due to automatic review settings May 26, 2026 13:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/update-copilot-skills.yaml
@botantler botantler Bot merged commit cd01660 into main May 26, 2026
37 checks passed
@botantler botantler Bot deleted the claude/ci-update-skills-app-token branch May 26, 2026 13:37
@github-project-automation github-project-automation Bot moved this from 🫴 Ready to ✅ Done in 🌊 Project Board May 26, 2026
@botantler
Copy link
Copy Markdown
Contributor

botantler Bot commented May 26, 2026

🎉 This PR is included in version 3.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@botantler botantler Bot added the released an issue that has been solved in a release label May 26, 2026
botantler Bot pushed a commit that referenced this pull request May 27, 2026
* ci: scope reusable-workflow App tokens to least privilege

Add explicit permission-* inputs to the six create-github-app-token
steps that minted unscoped tokens (inheriting blanket GitHub App
installation permissions), clearing the six standing zizmor/github-app
code-scanning alerts (#170-#175).

Each token is scoped to exactly what its consuming steps need, mirroring
each job's already-declared permissions block:
- enable-auto-merge (auto-merge): contents, pull-requests
- create-release (release): contents, issues, pull-requests (semantic-release)
- sync-cluster-policies (sync-policies): contents, pull-requests
- validate-go-project (tidy, golangci-lint): contents, pull-requests
- validate-go-project (lint): contents, issues, pull-requests

Additive and backward-compatible: the token scope only narrows; no
caller interface changes. update-copilot-skills.yaml was already scoped
in #240.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci: narrow git-push-only App tokens to contents-only

The App tokens in the tidy, golangci-lint, and mega-linter jobs are used
only as the git credential for checkout + git-auto-commit-action (pushing
linter auto-fixes). They are never used for PR/issue API calls — MegaLinter's
PR/issue reporting uses the default GITHUB_TOKEN, governed by the unchanged
job-level permissions block. So the App tokens need contents:write only;
drop the unused permission-pull-requests/permission-issues inputs to keep
them least-privileged (addresses the Copilot review on PR #245).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released an issue that has been solved in a release

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants