Create PR to bump staging to latest #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create PR to bump staging to latest | |
on: | |
workflow_dispatch: | |
jobs: | |
update-config: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current repository | |
uses: actions/checkout@v2 | |
- name: Get latest commit SHA from pathoplexus/pathoplexus | |
id: get_sha | |
run: | | |
LATEST_SHA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/pathoplexus/pathoplexus/commits/main | jq -r .sha) | |
echo "LATEST_SHA=$LATEST_SHA" >> $GITHUB_OUTPUT | |
- name: Update config.json | |
run: | | |
CONFIG_FILE="deploy/staging/config.json" | |
jq --arg sha "${{ steps.get_sha.outputs.LATEST_SHA }}" '.head_sha = $sha' $CONFIG_FILE > tmp.json && mv tmp.json $CONFIG_FILE | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "Bump staging to ${{ steps.get_sha.outputs.LATEST_SHA }}" | |
title: "Bump staging to ${{ steps.get_sha.outputs.LATEST_SHA }}" | |
body: | | |
This PR updates the staging deployment to ${{ steps.get_sha.outputs.LATEST_SHA }}. | |
https://github.com/pathoplexus/pathoplexus/commit/${{ steps.get_sha.outputs.LATEST_SHA }} | |
branch: staging-${{ steps.get_sha.outputs.LATEST_SHA }} | |
base: main |