diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 8afdec4..3220c97 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -14,9 +14,29 @@ name: Dependabot auto-merge # contents: write # pull-requests: write # uses: splitleafhq/.github/.github/workflows/dependabot-auto-merge.yml@ # +# +# A merge made with GITHUB_TOKEN starts no workflows, so a repo that deploys on +# push to main runs its deploy from a job that needs this one: +# +# deploy-merged: +# needs: automerge +# if: needs.automerge.outputs.merged == 'true' +# runs-on: ubuntu-latest +# timeout-minutes: 5 +# permissions: +# actions: write +# steps: +# - env: +# GH_TOKEN: ${{ github.token }} +# GH_REPO: ${{ github.repository }} +# run: gh workflow run deploy.yml --ref main on: workflow_call: + outputs: + merged: + description: "'true' when this run merged the pull request" + value: ${{ jobs.merge.outputs.merged }} permissions: contents: read @@ -28,11 +48,14 @@ jobs: permissions: contents: write pull-requests: write + outputs: + merged: ${{ steps.merge.outcome == 'success' }} steps: - name: Read the update type id: metadata uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 - name: Merge minor and patch updates + id: merge if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' env: GH_TOKEN: ${{ github.token }} diff --git a/docs/repo-standards.md b/docs/repo-standards.md index c361307..0698cc2 100644 --- a/docs/repo-standards.md +++ b/docs/repo-standards.md @@ -119,7 +119,7 @@ Use only GitHub's default labels and labels added by Dependabot. - Every active repo with workflows or package files has `.github/dependabot.yml`: `github-actions` at `/`, plus one entry per package ecosystem at the folder of its manifest. - Each entry runs weekly, uses commit prefix `chore` with the scope, and has one group named after the ecosystem for minor and patch updates. Major updates are not grouped. - Ignore an update only when it can't be taken yet, with a comment saying why and when to remove it. -- Dependabot auto-merge is an `automerge` job in `ci.yml` that calls this repo's shared workflow, [`dependabot-auto-merge.yml`](../.github/workflows/dependabot-auto-merge.yml), pinned to a commit SHA: `uses: splitleafhq/.github/.github/workflows/dependabot-auto-merge.yml@`. The workflow follows GitHub's documented pattern: it reads the update type with `dependabot/fetch-metadata`, never merges majors, and merges with `gh pr merge --squash --match-head-commit ` so a newer push can't merge untested. The job's `needs:` lists every other job in the workflow, or it merges before they finish; the header of the shared workflow shows the full job. +- Dependabot auto-merge is an `automerge` job in `ci.yml` that calls this repo's shared workflow, [`dependabot-auto-merge.yml`](../.github/workflows/dependabot-auto-merge.yml), pinned to a commit SHA: `uses: splitleafhq/.github/.github/workflows/dependabot-auto-merge.yml@`. The workflow follows GitHub's documented pattern: it reads the update type with `dependabot/fetch-metadata`, never merges majors, and merges with `gh pr merge --squash --match-head-commit ` so a newer push can't merge untested. The job's `needs:` lists every other job in the workflow, or it merges before they finish; the header of the shared workflow shows the full job. A merge made with `GITHUB_TOKEN` starts no workflows, so a repo that deploys on push to `main` adds a `deploy-merged` job that runs its deploy workflow when the shared workflow's `merged` output is `'true'` (also in the header). ## Exceptions