Fix: [AEA-0000] - safely upgrade validator #5
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: Update Validator Versions | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [master] | |
jobs: | |
update-validator: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout master branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.BRANCH_NAME }} | |
- name: Set up date-time branch name | |
id: datetime | |
run: | | |
# shellcheck disable=SC2086 | |
echo "BRANCH_NAME=update-validator-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV | |
- name: Create and switch to new branch | |
run: | | |
git checkout -b "$BRANCH_NAME" | |
- name: Run update script | |
run: ./scripts/update_validator_version.sh | |
- name: Check for changes | |
run: | | |
if git diff --quiet; then | |
echo "No changes to commit." | |
exit 0 | |
fi | |
- name: Create pull request | |
if: ${{ env.HAS_VALIDATOR_CHANGED == true }} | |
uses: peter-evans/[email protected] | |
with: | |
base: master | |
branch: "$BRANCH_NAME" | |
title: "Upgrade: [dependabot] - bump fhir validator from ${{ env.CURRENT_VALIDATOR_VERSION }} to ${{ env.NEW_VALIDATOR_VERSION }}" | |
body: "This PR was automatically created by GitHub Actions to update validator versions." | |
commit-message: "Update validator versions on $BRANCH_NAME" | |
sign-commits: true | |
token: ${{ secrets.VALIDATOR_UPGRADE_PAT }} |