Skip to content

fix(ci): make refresh-lockfiles re-trigger checks that actually run - #101

Merged
thomas-lg merged 2 commits into
mainfrom
fix/lockfile-workflow-retrigger
Aug 31, 2026
Merged

thomas-lg merged 2 commits into
mainfrom
fix/lockfile-workflow-retrigger

Conversation

@thomas-lg

Copy link
Copy Markdown
Owner

Self-testing refresh-lockfiles.yml (added earlier today in #86) against a deliberately stale branch turned up two bugs in its final step. My original verification run had hit the "lock files already consistent" path, so the commit/push/re-trigger half had never actually executed.

What was wrong

  1. A GITHUB_TOKEN push doesn't leave runnable checks. I'd assumed it raised no events at all; what actually happens is GitHub creates the pull_request runs and parks them as action_required, awaiting manual approval. Either way the required checks keep reporting their pre-fix state.
  2. gh pr update-branch was the only mitigation, and it silently no-ops. It reports ✓ PR branch already up-to-date whenever the PR isn't behind main. That's the common case right after a merge — and it left the PR with no runnable checks at all, so it couldn't merge and nothing would ever re-run.

The fix

Close and reopen the PR, which raises a fresh pull_request event that runs without approval. update-branch is kept, first, for main's strict up-to-date rule, and made non-fatal since no-op is a legitimate outcome.

Closing a Dependabot PR is normally its "don't recreate this update" signal; it's reopened within a second and then merged, so the update lands regardless. That tradeoff is noted in the step comment.

Evidence

On #100 — a branch with Serilog.AspNetCore downgraded in Api.csproj and the lock files deliberately untouched, reproducing Dependabot's exact NU1004:

step before after
backend on the broken head fail, both direct and transitive NU1004 —
workflow's commit/push committed exactly Api + Tests lock files, nothing else guard held
checks on the pushed head action_required — parked, never ran run to completion
backend after re-trigger never re-evaluated pass

The refresh logic itself was correct all along — it turned the red PR green. Only the re-trigger was broken.

Verified by dispatching this branch's version of the workflow via --ref before merging.

The re-trigger step was wrong in two ways, both found by self-testing the
workflow against a deliberately stale branch (PR #100):

1. A GITHUB_TOKEN push doesn't leave runnable checks. GitHub creates the
   pull_request runs but parks them as 'action_required', awaiting manual
   approval, so the required checks keep reporting their pre-fix state.
2. gh pr update-branch was the only mitigation, and it no-ops with
   'PR branch already up-to-date' whenever the PR isn't behind main -- which
   left the PR with no runnable checks at all, and unmergeable.

Closing and reopening the PR raises a fresh pull_request event that runs
without approval; verified by hand on #100, where it moved the parked runs to
in_progress and backend then passed. update-branch is kept first, for main's
strict up-to-date rule, and made non-fatal since no-op is a valid outcome.

The refresh itself was correct throughout: it committed exactly the two stale
lock files (Api directly, Tests transitively) and turned the red NU1004 PR
green.
@github-actions github-actions Bot added the fix label Aug 31, 2026
Close/reopen from inside the workflow doesn't help: the runs' triggering actor
is still github-actions[bot], so they stay parked as action_required. Verified
on PR #100 -- a bot close/reopen left CI parked, while the identical close/reopen
from a user token started it at once. GITHUB_TOKEN can't approve its own runs
either.

So stop pretending. The workflow still does the valuable part (restore, guard,
commit, push, update-branch), then detects whether the checks are parked and
prints the single command that finishes it, in both the job summary and a
warning annotation. Needs actions: read to list run states.

README no longer claims the workflow completes the loop unattended, and says
what closes it.
@thomas-lg
thomas-lg merged commit c523468 into main Aug 31, 2026
10 checks passed
@thomas-lg
thomas-lg deleted the fix/lockfile-workflow-retrigger branch August 31, 2026 20:16
thomas-lg added a commit that referenced this pull request Sep 13, 2026
…101)

* fix(ci): make refresh-lockfiles re-trigger checks that actually run

The re-trigger step was wrong in two ways, both found by self-testing the
workflow against a deliberately stale branch (PR #100):

1. A GITHUB_TOKEN push doesn't leave runnable checks. GitHub creates the
   pull_request runs but parks them as 'action_required', awaiting manual
   approval, so the required checks keep reporting their pre-fix state.
2. gh pr update-branch was the only mitigation, and it no-ops with
   'PR branch already up-to-date' whenever the PR isn't behind main -- which
   left the PR with no runnable checks at all, and unmergeable.

Closing and reopening the PR raises a fresh pull_request event that runs
without approval; verified by hand on #100, where it moved the parked runs to
in_progress and backend then passed. update-branch is kept first, for main's
strict up-to-date rule, and made non-fatal since no-op is a valid outcome.

The refresh itself was correct throughout: it committed exactly the two stale
lock files (Api directly, Tests transitively) and turned the red NU1004 PR
green.

* fix(ci): report the approval gate instead of trying to defeat it

Close/reopen from inside the workflow doesn't help: the runs' triggering actor
is still github-actions[bot], so they stay parked as action_required. Verified
on PR #100 -- a bot close/reopen left CI parked, while the identical close/reopen
from a user token started it at once. GITHUB_TOKEN can't approve its own runs
either.

So stop pretending. The workflow still does the valuable part (restore, guard,
commit, push, update-branch), then detects whether the checks are parked and
prints the single command that finishes it, in both the job summary and a
warning annotation. Needs actions: read to list run states.

README no longer claims the workflow completes the loop unattended, and says
what closes it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant