Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Dependabot Automerge
permissions:
contents: write
pull-requests: write
# `actions: write` lets the post-merge step kick off Node.js Package on
# the default branch via `gh workflow run`. Without this, automerge'd
# PRs land on main but the on-push release job never fires (GitHub
# Actions intentionally suppresses on:push triggers when the push is
# authenticated with GITHUB_TOKEN).
actions: write
on:
workflow_run:
workflows:
Expand All @@ -21,10 +27,19 @@ jobs:
uses: actions/checkout@v6

- name: Automerge
id: automerge
uses: "pascalgn/automerge-action@v0.16.4"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_METHOD: squash
MERGE_LABELS: ""
MERGE_RETRY_SLEEP: "100000"

- name: Trigger release on default branch
# `pascalgn/automerge-action` exits 0 whether or not it merged. Skip
# the dispatch when nothing was actually merged so we don't kick a
# phantom release run on every Dependabot Automerge invocation.
if: steps.automerge.outputs.mergeResult == 'merged'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run test-and-release.yml --ref ${{ github.event.repository.default_branch }}
8 changes: 7 additions & 1 deletion .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Node.js Package
on: [push]
on:
push:
# Invoked by automerge.yml after a Dependabot PR is merged. GitHub
# Actions doesn't fire on:push when the push is authored by GITHUB_TOKEN
# (the automerge action's only available identity), so without this
# dispatch trigger the release job never runs after auto-merges.
workflow_dispatch:

# id-token: write must be granted here so the reusable npmpublish workflow
# can request an OIDC token for npm trusted publishing.
Expand Down
Loading