Skip to content

.github: add generic automerge script with dry-run support - #209

Open
lumachad wants to merge 2 commits into
amd-stagingfrom
users/lumachad/automerge_2
Open

.github: add generic automerge script with dry-run support#209
lumachad wants to merge 2 commits into
amd-stagingfrom
users/lumachad/automerge_2

Conversation

@lumachad

@lumachad lumachad commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Make the automerge script fully generic: repo slug, target branch, and upstream branch are read from required repository variables (AUTOMERGE_TARGET_BRANCH, AUTOMERGE_UPSTREAM_BRANCH) instead of being hardcoded. The script exits with an error if any are unset.
  • Push conflict-free branches by direct refspec to avoid local merge commits.
  • Add --dry-run mode: fetches and probes normally but skips all pushes and PR creation, printing what it would do instead (branch name, commit range, PR title, and conflicted files if applicable).
  • Wire --dry-run to a boolean workflow_dispatch input so it can be toggled from the Actions UI.
  • Use "conflict-free" instead of "fast-forward" throughout: the script merges rather than pointer-advances, so the old term was misleading.
  • Activate the workflow: remove the if: false guard and re-enable the schedule and pull_request triggers. The pull_request condition narrows to PRs merged into AUTOMERGE_TARGET_BRANCH carrying the merge-testing or merge-conflict label.

Repository variables required

  • AUTOMERGE_TARGET_BRANCH — branch to merge into (e.g. amd-staging)
  • AUTOMERGE_UPSTREAM_BRANCH — upstream branch to pull from (e.g. master)

Test plan

  • Trigger manually from the Actions UI with dry-run checked — verify no pushes or PRs are created, output shows what would happen
  • Trigger manually with dry-run unchecked — verify origin/master is updated and a conflict-free or conflict PR is opened

@lumachad lumachad self-assigned this Jul 14, 2026
@lumachad lumachad added the ci:skip Skip all pre-commit / CI jobs while the label is up label Jul 14, 2026
@lumachad
lumachad force-pushed the users/lumachad/automerge_2 branch 3 times, most recently from 848c3fb to 9dfe6b8 Compare July 20, 2026 11:47
@lumachad lumachad changed the title .github: add dry-run input to automerge workflow .github: add generic automerge script with dry-run support Jul 20, 2026
@lumachad
lumachad force-pushed the users/lumachad/automerge_2 branch from 9dfe6b8 to b709061 Compare July 20, 2026 12:18
@lumachad
lumachad marked this pull request as ready for review July 20, 2026 12:18
@lumachad
lumachad requested a review from a team as a code owner July 20, 2026 12:18
@lumachad lumachad assigned lancesix and unassigned lumachad Jul 20, 2026
lumachad and others added 2 commits July 21, 2026 11:08
Make the script fully generic by reading the repo slug, target branch,
and upstream branch from required environment variables (GITHUB_REPOSITORY,
AUTOMERGE_TARGET_BRANCH, AUTOMERGE_UPSTREAM_BRANCH) instead of hardcoding
them.  Push conflict-free branches by direct refspec to avoid local merge
commits.

Add --dry-run mode that fetches and probes normally but skips all pushes
and PR creation, printing what it would do instead.  Wire it to a
boolean workflow_dispatch input in the YAML.

Use "conflict-free" instead of "fast-forward" throughout: the script
merges (not pointer-advances), so "fast-forward" was misleading.
Rename branch prefix, label constant, functions, and all user-visible
strings accordingly; the merge-testing label value is unchanged.
Remove the if: false guard and enable the job.  The pull_request trigger
fires on any closed PR; the job condition narrows it to PRs that were
merged into AUTOMERGE_TARGET_BRANCH and carry the merge-testing or
merge-conflict label.

Co-Authored-By: Claude <noreply@anthropic.com>
@lumachad
lumachad force-pushed the users/lumachad/automerge_2 branch from b709061 to a281154 Compare July 21, 2026 16:12
@lumachad

Copy link
Copy Markdown
Collaborator Author

Updated to do a general FF -> conflict-free merge renaming.

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

Labels

ci:skip Skip all pre-commit / CI jobs while the label is up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants