Skip to content

chore(ci): auto-commit SKILL.md when stale#224

Merged
BYK merged 6 commits intomainfrom
chore/auto-commit-skill-md
Feb 10, 2026
Merged

chore(ci): auto-commit SKILL.md when stale#224
BYK merged 6 commits intomainfrom
chore/auto-commit-skill-md

Conversation

@betegon
Copy link
Member

@betegon betegon commented Feb 10, 2026

Summary

When check-skill detects SKILL.md is out of date, auto-commit the regenerated file instead of failing CI with instructions.

check-skill.ts already runs generate-skill.ts internally and leaves the updated file on disk — so we just need to git add, commit, and push when the check fails.

Changes

Replaced the "Output regeneration instructions" step (which printed manual fix commands and failed the build) with a step that commits and pushes the regenerated SKILL.md using the github-actions[bot] identity.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Cli

  • Add setup command for shell integration by BYK in #213
  • Add plural command aliases for list commands by betegon in #209

Other

  • (formatters) Display span duration in span tree by betegon in #219
  • (log) Add view command to display log entry details by betegon in #212
  • (repo) Add repo list command by betegon in #222
  • (setup) Auto-install Claude Code agent skill during setup by BYK in #216
  • (trace) Add trace list and view commands by betegon in #218

Bug Fixes 🐛

Upgrade

  • Handle EPERM in isProcessRunning for cross-user locks by BYK in #211
  • Replace curl pipe with direct binary download by BYK in #208

Other

  • (craft) Use regex pattern for binary artifact matching by BYK in #230
  • (deps) Move runtime dependencies to devDependencies by BYK in #225
  • (telemetry) Correct runtime context for Bun binary by BYK in #231

Documentation 📚

  • (log) Add documentation for sentry log view command by betegon in #214
  • Add documentation for log command by betegon in #210

Internal Changes 🔧

Ci

  • Auto-commit SKILL.md when stale by betegon in #224
  • Auto-commit SKILL.md when stale by betegon in #224
  • Remove merge-artifacts job with Craft 2.21.1 by BYK in #215

Other

  • (project) Replace --org flag with org/project positional by betegon in #223
  • (setup) Unify binary placement via setup --install by BYK in #217
  • Rename CI workflow to Build and fix artifact filter by BYK in #229
  • Handle fork PRs in SKILL.md auto-commit by BYK in #227
  • Enable minify for standalone binaries by BYK in #220

Other


🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 3871 uncovered lines.
✅ Project coverage is 69.85%. Comparing base (base) to head (head).

Files with missing lines (67)
File Patch % Lines
human.ts 56.16% ⚠️ 395 Missing
resolve-target.ts 20.26% ⚠️ 366 Missing
list.ts 14.39% ⚠️ 345 Missing
api-client.ts 66.37% ⚠️ 230 Missing
list.ts 23.47% ⚠️ 212 Missing
oauth.ts 25.10% ⚠️ 194 Missing
list.ts 21.96% ⚠️ 167 Missing
plan.ts 19.37% ⚠️ 154 Missing
help.ts 19.85% ⚠️ 109 Missing
upgrade.ts 57.71% ⚠️ 107 Missing
view.ts 36.48% ⚠️ 101 Missing
interactive-login.ts 9.17% ⚠️ 99 Missing
view.ts 25.81% ⚠️ 92 Missing
view.ts 39.44% ⚠️ 86 Missing
clipboard.ts 4.49% ⚠️ 85 Missing
status.ts 24.07% ⚠️ 82 Missing
migration.ts 47.44% ⚠️ 82 Missing
list.ts 27.18% ⚠️ 75 Missing
browser.ts 4.11% ⚠️ 70 Missing
login.ts 33.33% ⚠️ 64 Missing
span-tree.ts 5.00% ⚠️ 57 Missing
explain.ts 33.33% ⚠️ 56 Missing
telemetry.ts 79.86% ⚠️ 56 Missing
api.ts 89.80% ⚠️ 47 Missing
upgrade.ts 66.91% ⚠️ 46 Missing
seer.ts 75.54% ⚠️ 45 Missing
schema.ts 89.56% ⚠️ 40 Missing
refresh.ts 40.63% ⚠️ 38 Missing
seer.ts 79.87% ⚠️ 30 Missing
preload.ts 53.23% ⚠️ 29 Missing
view.ts 87.27% ⚠️ 28 Missing
utils.ts 88.94% ⚠️ 25 Missing
view.ts 61.54% ⚠️ 25 Missing
detector.ts 90.10% ⚠️ 20 Missing
binary.ts 88.67% ⚠️ 17 Missing
list.ts 91.16% ⚠️ 16 Missing
code-scanner.ts 95.00% ⚠️ 16 Missing
help.ts 57.14% ⚠️ 15 Missing
arg-parsing.ts 90.00% ⚠️ 12 Missing
dsn-cache.ts 94.62% ⚠️ 12 Missing
logout.ts 56.00% ⚠️ 11 Missing
token.ts 52.17% ⚠️ 11 Missing
fix.ts 83.61% ⚠️ 10 Missing
qrcode.ts 33.33% ⚠️ 10 Missing
fs-utils.ts 57.14% ⚠️ 9 Missing
view.ts 94.70% ⚠️ 7 Missing
project-root.ts 97.73% ⚠️ 7 Missing
version-check.ts 91.76% ⚠️ 7 Missing
feedback.ts 84.21% ⚠️ 6 Missing
auth.ts 95.52% ⚠️ 6 Missing
shell.ts 96.23% ⚠️ 6 Missing
app.ts 93.59% ⚠️ 5 Missing
resolver.ts 94.57% ⚠️ 5 Missing
setup.ts 97.84% ⚠️ 4 Missing
list.ts 97.33% ⚠️ 4 Missing
index.ts 95.96% ⚠️ 4 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
project-root-cache.ts 96.92% ⚠️ 2 Missing
output.ts 89.47% ⚠️ 2 Missing
alias.ts 99.42% ⚠️ 1 Missing
completions.ts 99.37% ⚠️ 1 Missing
env-file.ts 99.19% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
colors.ts 97.96% ⚠️ 1 Missing
trace.ts 99.16% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    69.85%    69.85%        —%
==========================================
  Files          105       105         —
  Lines        12841     12841         —
  Branches         0         0         —
==========================================
+ Hits          8970      8970         —
- Misses        3871      3871         —
- Partials         0         0         —

Generated by Codecov Action

@BYK
Copy link
Member

BYK commented Feb 10, 2026

This will not work as when you auto commit, it will be done through GITHUB_TOKEN which would then prevent further check runs to run

@BYK
Copy link
Member

BYK commented Feb 10, 2026

You can add a pre-commit hook if you prefer

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

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

Would not work as expected so blocking

@BYK
Copy link
Member

BYK commented Feb 10, 2026

@betegon betegon force-pushed the chore/auto-commit-skill-md branch from bb1d891 to 75ea808 Compare February 10, 2026 19:57
betegon and others added 4 commits February 10, 2026 20:59
Switch from getsentry/action-github-app-token with SENTRY_INTERNAL_APP
to actions/create-github-app-token with SENTRY_RELEASE_BOT, matching
the token flow used in release.yml.
@BYK BYK marked this pull request as ready for review February 10, 2026 22:10
Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

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

Token flow now matches release.yml (actions/create-github-app-token with SENTRY_RELEASE_BOT). Auto-commit verified working — CI auto-committed regenerated SKILL.md successfully. Test change reverted.

@BYK BYK enabled auto-merge (squash) February 10, 2026 22:11
@BYK BYK merged commit 213f68f into main Feb 10, 2026
23 checks passed
@BYK BYK deleted the chore/auto-commit-skill-md branch February 10, 2026 22:13
Comment on lines +75 to +79
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add plugins/sentry-cli/skills/sentry-cli/SKILL.md
git commit -m "chore: regenerate SKILL.md"
git push
Copy link

Choose a reason for hiding this comment

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

Bug: The check-skill job attempts to git push to fork repositories when SKILL.md is stale, but the SENTRY_RELEASE_BOT token likely lacks permissions, causing CI to fail.
Severity: HIGH

Suggested Fix

Modify the workflow to avoid attempting a git push when the trigger is a pull request from a fork. This can be achieved by adding a condition to the push step, such as if: github.repository == 'getsentry/cli', to ensure it only runs on the main repository and not on forks.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/ci.yml#L75-L79

Potential issue: In the `check-skill` job, when a pull request from a fork has a stale
`SKILL.md` file, the workflow attempts to automatically commit and push a fix. The
checkout step correctly uses `github.head_ref`, targeting the branch in the fork.
However, the subsequent `git push` uses a token generated for the `SENTRY_RELEASE_BOT`
GitHub App. This app's token is unlikely to have write permissions to the contributor's
fork repository. As a result, the push operation will fail with a permission error,
causing the entire CI job to fail for external contributors.

Did we get this right? 👍 / 👎 to inform future reviews.

BYK added a commit that referenced this pull request Feb 10, 2026
## Summary

Fixes a bug introduced in #224 where the `check-skill` CI job would fail
for fork PRs.

## Problem

The auto-commit flow for stale SKILL.md uses a GitHub App token
(`SENTRY_RELEASE_BOT`) to push commits back to the branch. This fails
for fork PRs because:

1. **Secrets are unavailable** — GitHub does not expose repo secrets to
`pull_request` workflows triggered from forks (security policy)
2. **No push access** — Even if the token were available, the GitHub App
is installed on `getsentry/cli`, not the contributor's fork

## Fix

- **Skip the token step** for fork PRs (conditional on
`github.event.pull_request.head.repo.full_name == github.repository`)
- **Fall back to `github.token`** for checkout when the app token isn't
available
- **Auto-commit** only when the app token was successfully obtained
(same-repo PRs and push events)
- **Fail with an actionable error** for fork PRs, asking the contributor
to run `bun run generate:skill` locally
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

uses: actions/create-github-app-token@v2.2.1
with:
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
Copy link

Choose a reason for hiding this comment

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

Token step breaks check-skill job for fork PRs

High Severity

The Get auth token step runs unconditionally as the first step of check-skill, but secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY is not available for fork PRs (GitHub withholds secrets from fork pull_request workflows). This causes actions/create-github-app-token to fail immediately, breaking the entire job — even when SKILL.md is perfectly up to date. Previously, the job needed no secrets and would pass cleanly for fork PRs with a current SKILL.md. The failure cascades through ci-status, blocking the whole CI pipeline. The old code explicitly handled forks via IS_FORK.

Additional Locations (1)

Fix in Cursor Fix in Web

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants