Skip to content

Commit

Permalink
Enable automerge on pre and post-release workflows (#2010)
Browse files Browse the repository at this point in the history
* Prepare pre and post-release workflows for automerge

* Minor changes

* Rename job

* Remove skip ci label

* Add bot as a reviewer

* Add automerge steps

* Fix typo

* Require `credits` job

* Pin pip packages

* Add team-reviewers field
  • Loading branch information
epassaro committed Jun 7, 2022
1 parent 258ac90 commit b394f46
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defaults:
shell: bash -l {0}

jobs:
build:
build-docs:

if: github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
python-version: '3.x'

- name: Install rst-include
run: pip install rst-include requests
run: pip install rst-include==2.1.2.2 requests==2.27.1

- name: Update README.rst
run: python .ci-helpers/update_credits.py
Expand All @@ -84,7 +84,7 @@ jobs:
docs/resources/credits.rst
pull_request:
needs: [changelog, citation]
needs: [changelog, citation, credits]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -122,5 +122,21 @@ jobs:
> :warning: **Warning:**
>
> The `post_release` workflow waits for a webhook and then updates `CITATION.cff`. If the file is not modified by this pull request, please check the latest release on [Zenodo's website](https://zenodo.org/record/592480), close this pull request, and [manually run the workflow](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow).
labels: documentation,
reviewers: wkerzendorf, andrewfullard, epassaro
labels: automerge, build-docs
reviewers: tardis-bot
team-reviewers: tardis-infrastructure
id: create-pr

- name: Approve pull request
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.BOT_TOKEN }}
number: ${{ steps.create-pr.outputs.pull-request-number }}
if: steps.create-pr.outputs.pull-request-operation == 'created'

- name: Enable automerge
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.BOT_TOKEN }}
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }}
merge-method: squash
45 changes: 39 additions & 6 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,44 @@ jobs:
title: Pre-release ${{ env.DATE }}
body: |
*\*beep\* \*bop\**
Hi, human.
I prepared everything for a new TARDIS release.
If all **checks pass**, merge this pull request and I'll do the rest.
labels: build-docs, CI-CD, priority - high :fire:,
reviewers: wkerzendorf, andrewfullard, epassaro
<br>
> :warning: **WARNING:**
>
> This pull request has been labeled as `automerge` and will be merged automatically after the checks are completed. **Do not merge manually if any check fails**.
>
> Instead, remove the `automerge` label and push your fixes to the [`pre-release-${{ env.DATE }}`](https://github.com/tardis-bot/tardis/tree/pre-release-${{ env.DATE }}) branch on [**tardis-bot/tardis**](https://github.com/tardis-bot/tardis).
>
> ```
> $ git remote add tardis-bot git@github.com:tardis-bot/tardis.git
> $ git fetch tardis-bot
> $ git checkout tardis-bot/pre-release-${{ env.DATE }}
> $ git add <file_1> <file_2> ...
> $ git commit -m "<your_commit_message>"
> $ git push tardis-bot HEAD:pre-release-${{ env.DATE }}
> ```
>
> Once all the checks pass, you can safely merge this pull request manually.
labels: automerge, build-docs
reviewers: tardis-bot
team-reviewers: tardis-infrastructure
id: create-pr

- name: Approve pull request
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.BOT_TOKEN }}
number: ${{ steps.create-pr.outputs.pull-request-number }}
if: steps.create-pr.outputs.pull-request-operation == 'created'

- name: Enable automerge
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.BOT_TOKEN }}
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }}
merge-method: squash

0 comments on commit b394f46

Please sign in to comment.