Skip to content

Commit

Permalink
Use ehrQL approach to creating PRs automatically
Browse files Browse the repository at this point in the history
See #118.

Based on https://github.com/opensafely-core/ehrql/blob/6a6e0140ed85166028c4316e51820d02199c0483/.github/workflows/update-external-studies.yml

The creating a PR step currently fails, most likely because the
associated `JOB_SERVER_PR_TOKEN` has expired.
  • Loading branch information
StevenMaude committed Jul 10, 2024
1 parent b6ff8e6 commit 7351af6
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/create-job-server-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,27 @@ jobs:
id: create_pr
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
token: "${{ secrets.JOB_SERVER_PR_TOKEN }}"
branch: bot/update-interactive-templates
base: main
add-paths: requirements.prod.*
author: "opensafely-github-bot <[email protected]>"
committer: "opensafely-github-bot <[email protected]>"
commit-message: "feat: Update interactive templates to ${{ env.UPDATED_VERSION }}"
title: "Update interactive templates to ${{ env.UPDATED_VERSION }}"
body: "Update interactive-templates to ${{ env.UPDATED_VERSION }}"

# untested
#- name: Enable automerge
# if: steps.create_pr.outputs.pull-request-operation == 'created'
# env:
# GH_TOKEN: "${{ secrets.JOB_SERVER_PR_TOKEN }} "
# run: gh pr merge --merge --auto --squash ${{ steps.create_pr.outputs.pull-request-number }}
body: |
To get tests to run on this PR there's an odd workflow:
- Approve it
- Close it
- Re-open it
- Re-enable automerge
You can read more on why this is needed in the `create-pull-request` [docs][1].
[1]: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs
# The PR will still require manual approval, this just reduces it to a one-click process
- name: Enable automerge
if: steps.create_pr.outputs.pull-request-operation == 'created'
run: gh pr merge --auto --squash ${{ steps.create_pr.outputs.pull-request-number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 7351af6

Please sign in to comment.