Skip to content

Heal Dependabot hygiene from the pins catalog - #677

Open
sargunv wants to merge 2 commits into
mainfrom
cursor/dependabot-hygiene-healing-5433
Open

Heal Dependabot hygiene from the pins catalog#677
sargunv wants to merge 2 commits into
mainfrom
cursor/dependabot-hygiene-healing-5433

Conversation

@sargunv

@sargunv sargunv commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Copy maplibre-compose's Dependabot hygiene flow so mise run fix rewrites action pins and the hygiene job commits the result on same-repo Dependabot pull requests.

Test plan

Ran ci:test-release-tools, ci:check-action-pins, and ci:generate-workflow --check.

AI assistance

  • Tools: Cursor
  • Context: Ported the Dependabot hygiene job, ci:fix-action-pins, and ci:commit-hygiene-fixes from maplibre-compose.
Open in Web Open in Cursor 

Copy maplibre-compose's Dependabot hygiene flow: fix-action-pins
rewrites consumers from the catalog, and the hygiene job commits
mise run fix on same-repo Dependabot pull requests.

Co-authored-by: Sargun Vohra <sargunv@users.noreply.github.com>
@sargunv
sargunv marked this pull request as ready for review September 2, 2026 04:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T04:53:34.449697Z 4ca1d0e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds automatic action-pin healing for same-repository Dependabot pull requests.

  • Copies catalog pins into workflow and composite-action consumers through mise run fix.
  • Commits hygiene-generated changes and dispatches CI for the updated Dependabot branch.
  • Adds tests and contributor documentation for the pin catalog workflow.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
.mise/tasks/ci/commit-hygiene-fixes Adds a task that commits tracked hygiene changes, pushes the Dependabot branch, and dispatches CI.
.mise/tasks/ci/generate-workflow Generates the Dependabot-aware hygiene checkout, repair, commit, and workflow-dispatch sequence.
ci/action_pins.py Extends action-pin validation with deterministic rewriting of mismatched consumer references.
ci/tests/test_action_pins.py Covers pin checking, rewriting, idempotence, consumer discovery, and newline normalization.
.github/workflows/ci.yml Updates generated CI with Dependabot hygiene healing and manual workflow dispatch support.

Sequence Diagram

sequenceDiagram
  participant D as Dependabot PR
  participant H as Hygiene job
  participant P as Pin fixer
  participant G as Git branch
  participant C as Dispatched CI
  D->>H: pull_request event
  H->>P: mise run fix
  P-->>H: Rewrite consumers from pin catalog
  H->>H: Regenerate workflow and generators
  H->>G: Commit and push hygiene changes
  H->>C: Dispatch CI on updated branch
Loading

Reviews (2): Last reviewed commit: "Heal generated workflow pins before hygi..." | Re-trigger Greptile

Comment on lines +27 to +29
fi
if [[ ${committed} != true && $(git log -1 --pretty=%s) != "chore: apply hygiene fixes" ]]; then
exit 0

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.

P2 Clean reruns redispatch unchanged CI

When the workflow is rerun after a previous invocation pushed chore: apply hygiene fixes, the clean tree still bypasses this early return based solely on the tip commit message. The script then pushes an unchanged branch and starts another complete CI workflow for the same commit, wasting CI capacity and potentially producing concurrent runs for one SHA.

Fix in Cursor Cloud Agents

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ca1d0eeb0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +252 to +254
" permissions:",
" contents: write",
" actions: write",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use an event that can push Dependabot fixes

When DEPENDABOT_PR is true, this job was triggered by a Dependabot pull_request; GitHub treats these runs like fork-originated workflows and gives them a read-only GITHUB_TOKEN, despite the requested write scopes (GitHub documentation). Consequently, commit-hygiene-fixes can create its local commit, but git push fails with a permission error, so neither the fix nor the follow-up dispatch reaches the branch.

Useful? React with 👍 / 👎.

Comment on lines +279 to +284
" - id: apply-fix",
" if: env.DEPENDABOT_PR == 'true'",
" env:",
" GH_TOKEN: ${{ github.token }}",
" HEAD_REF: ${{ github.head_ref }}",
" run: mise run ci:commit-hygiene-fixes",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move pin healing before generated checks

When Dependabot updates .github/workflows/action-pins.yml, the generator immediately expects .github/workflows/ci.yml to contain the new catalog references, but mise run ci:generate-workflow --check runs at line 269 before mise run fix, which is the first command that invokes the new action-pin fixer. The hygiene job therefore exits on the stale generated workflow and never reaches this commit step, defeating the healing flow for every action-pin update.

Useful? React with 👍 / 👎.

Comment thread .mise/tasks/ci/commit-hygiene-fixes Outdated
Comment on lines +8 to +9
if ! git diff --quiet || ! git diff --cached --quiet; then
git add --update

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the lockfile exclusion when committing fixes

When mise rewrites any tracked root mise*.lock file during a Dependabot hygiene run, this unrestricted dirty-tree check stages and commits it, even though the workflow's existing generated-file check deliberately excludes those files at lines 289-290. This turns tolerated, runner-generated lockfile changes into bot-authored dependency-PR changes and can trigger an unnecessary full CI dispatch; apply the same path exclusion when deciding what to commit and when staging it.

Useful? React with 👍 / 👎.

Dependabot catalog bumps must rewrite ci.yml after mise run fix,
or generate-workflow --check fails first. Keep mise.lock out of
the hygiene commit the same way the final diff check does.

Co-authored-by: Sargun Vohra <sargunv@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28ccd6e45c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +252 to +254
" permissions:",
" contents: write",
" actions: write",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Isolate write permissions from ordinary pull requests

When a non-Dependabot same-repository pull request runs hygiene, this job-level block still grants every PR-controlled step—including ./.github/actions/setup-ci-deps and the mise tasks—contents: write and actions: write; the later DEPENDABOT_PR conditions restrict only checkout and commit steps, not token availability. Because actions can access github.token even when it is not passed explicitly, code introduced by such a PR can mutate repository contents or workflow runs before review. Keep the general hygiene job read-only and move the privileged healing path into a separately constrained job or event.

Useful? React with 👍 / 👎.

git push
# GITHUB_TOKEN pushes do not start new workflow runs, so dispatch CI on the
# updated branch after the push.
gh workflow run CI --ref "${HEAD_REF}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Re-run the healed commit in pull-request context

When hygiene pushes a generated-fix commit, the push deliberately creates no pull_request run, and this replacement dispatch uses HEAD_REF; gh workflow run --help defines --ref as the “Branch or tag name which contains the version of the workflow file,” so the resulting run checks the raw Dependabot branch and has no pull-request merge ref or payload. The earlier PR run remains attached to the pre-fix commit, meaning the final required checks never test the healed commit merged with the current base branch. Trigger the follow-up in a way that preserves pull-request merge-context coverage.

Useful? React with 👍 / 👎.

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