Skip to content

Dependabot approval workflow updates#6112

Merged
beets merged 14 commits intodatacommonsorg:masterfrom
beets:dependabot
Mar 24, 2026
Merged

Dependabot approval workflow updates#6112
beets merged 14 commits intodatacommonsorg:masterfrom
beets:dependabot

Conversation

@beets
Copy link
Collaborator

@beets beets commented Mar 21, 2026

Summary

This PR refactors the Dependabot auto-merge pipeline to resolve critical queue-jamming bugs.

Previously, the approve-and-merge-7-days job on master implemented a 7-day wait period and a sequential active queue lock (autoMergeRequest != null), but it lacked any mechanism to handle persistent errors. If a Dependabot PR encountered failing tests or upstream merge conflicts, it would indefinitely block the entire active queue.

This update overhauls the workflow to function as a resilient State Machine, aggressively identifying edge cases via the GitHub GraphQL API to automatically unlock the pipeline.

What This Fixes

  • Queue Deadlocks (Failing Tests): The script now parses statusCheckRollup natively. If a running test returns FAILURE or ERROR, the workflow automatically applies a failing label and ignores the branch moving forward, fully preventing broken updates from stalling the active queue indefinitely.
  • Queue Deadlocks (Merge Conflicts): The script now queries mergeStateStatus. Operations identifying as DIRTY are immediately explicitly tagged as merge-conflict and dropped from the queue.
  • Pagination Truncation Bug: Bumped the gh pr list --limit parameter from 100 to 1000. This prevents GitHub's native createdAt descending sort order from silently truncating the oldest target PRs when clearing massive backlogs.

Structural Enhancements

  • Enhanced Flow Observability: Refactored the single monolithic bash script into 5 discrete GitHub Action Steps (Fetch, Isolate Conflicted, Isolate Failing, Evaluate Queue Lock, Dispatch Target). This offers instant visibility into the exact step of the state machine directly from the GitHub Actions UI.
  • Streamlined API Usage: The 5 separate steps share a single local $ALL_PRS_JSON payload (/tmp/dependabot_prs.json), meaning the script isolates all 4 validation states using exactly 1 API call per 30 minutes.
  • Explicit Block Logging: The active queue lock check now echoes the exact Dependabot URL natively holding the lock sequence to massively simplify root-cause debugging.
  • Manual Ghosting: Added a native ignore label. Developers can now explicitly append an ignore tag via the GitHub UI at any time to forcefully drop any PR from the workflow's memory natively.

Developer Interventions

  • To retry a failed PR: Delete the failing or merge-conflict label on the branch and comment @dependabot rebase. The active queue will sequentially process it again on the next run.
  • To bypass a PR entirely: Apply the ignore label.

beets and others added 11 commits February 27, 2026 11:33
### Summary
This PR refactors the Dependabot auto-merge workflow to use a deterministic state machine, removing the previous reliance on time-based polling.

The previous logic used a 24-hour `updatedAt` threshold to guess the state of a PR, which could lead to stalled pipelines if a PR encountered transient errors or merge conflicts. This update directly evaluates GitHub's CI and merge states to accurately process the queue.

### Key Changes
- **Explicit State Management**: The workflow now parses the `statusCheckRollup` and `mergeStateStatus` fields from the GitHub API using `jq` to determine a PR's exact status.
- **Permanent Isolation for Failures**: If a PR fails its tests (returns `FAILURE` or `ERROR`), the script automatically applies a `failing` label and completely ignores it in future runs. This prevents broken PRs from repeatedly jamming the active queue.
- **Handling Merge Conflicts**: PRs with upstream base conflicts (status `DIRTY`) are now explicitly tagged with a `merge-conflict` label and safely bypassed.
- **Manual Overrides**: Added an `ignore` label. Developers can manually apply this tag via the GitHub UI to force the workflow to indefinitely bypass a specific PR and unlock the queue.
- **Improved Logging**: The pipeline lock check now prints the exact URL of the PR currently holding the lock, rather than just returning the active queue length, which drastically simplifies debugging.

### Developer Interventions
- **To retry a failed PR**: Remove the `failing` or `merge-conflict` label and comment `@dependabot rebase`. The workflow will pick it back up on the next run.
- **To skip a PR entirely**: Add the `ignore` label.
- **To bypass the 7-day wait**: Manually approve and merge the PR through the GitHub UI.
@gemini-code-assist
Copy link
Contributor

Note

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

@beets beets requested review from gmechali and juliawu March 23, 2026 14:39
@beets beets marked this pull request as ready for review March 23, 2026 14:39
Copy link
Contributor

@juliawu juliawu left a comment

Choose a reason for hiding this comment

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

Very cool!

@beets beets enabled auto-merge (squash) March 24, 2026 06:23
@beets beets merged commit 67fc898 into datacommonsorg:master Mar 24, 2026
13 checks passed
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