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
40 changes: 40 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: dependabot

# Dependabot's pull requests merge themselves once ci is green on the very
# commit it checked; one that breaks the build (often a major version) stays
# open until it is fixed by hand. A merge made with the workflow token starts
# no push workflows, so this one starts the development build itself.
on:
workflow_run:
workflows: [ci]
types: [completed]

permissions:
contents: write
pull-requests: write
actions: write

jobs:
merge:
if: >-
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' &&
startsWith(github.event.workflow_run.head_branch, 'dependabot/') &&
github.event.workflow_run.head_repository.full_name == github.repository
runs-on: ubuntu-latest
concurrency:
group: dependabot-merge
cancel-in-progress: false
steps:
- name: Merge
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
BRANCH: ${{ github.event.workflow_run.head_branch }}
SHA: ${{ github.event.workflow_run.head_sha }}
run: |
pr=$(gh pr list --head "$BRANCH" --state open --json number,author \
--jq '.[] | select(.author.login == "app/dependabot") | .number')
[[ -n $pr ]] || { echo "No open Dependabot pull request for $BRANCH"; exit 0; }
gh pr merge "$pr" --squash --delete-branch --match-head-commit "$SHA"
gh workflow run release.yml --ref main
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ jobs:
GH_REPO: ${{ github.repository }}
run: python3 .github/scripts/release_reminder.py

# Only a push can start the build and publication jobs: a tag names its
# Only a push or a manual start on main (the dependabot workflow uses it after
# merging) can start the build and publication jobs: a tag names its
# release, main becomes the next patch version's development build.
version:
if: github.event_name == 'push'
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
Expand Down
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ available". So they are short and plain:
deletes the branch.
- Contributors with write access merge their own pull requests the same
way. Release tags are the maintainer's alone; see below.
- Dependabot's pull requests merge themselves (`.github/workflows/dependabot.yml`)
once ci is green, and start a development build. One that stays red
(usually a major version) waits to be fixed on its branch.

## Releases

Expand Down