From b3e71b112aec75042854366e368ef777bed3c78b Mon Sep 17 00:00:00 2001 From: Anthony Brown <121869075+anthony-nhs@users.noreply.github.com> Date: Mon, 28 Oct 2024 10:12:33 +0000 Subject: [PATCH] github action to update validator version --- .../workflows/update_validator_version.yml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/update_validator_version.yml diff --git a/.github/workflows/update_validator_version.yml b/.github/workflows/update_validator_version.yml new file mode 100644 index 0000000000..885da572df --- /dev/null +++ b/.github/workflows/update_validator_version.yml @@ -0,0 +1,63 @@ +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@v3 + with: + ref: master + + - 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_versions.sh + + - name: Check for changes + run: | + if git diff --quiet; then + echo "No changes to commit." + exit 0 + fi + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Commit changes + run: | + git add . + git commit -m "Update validator versions on $BRANCH_NAME" + + - name: Push new branch to repository + run: | + git push origin "$BRANCH_NAME" + + - name: Create pull request + uses: peter-evans/create-pull-request@v7.0.5 + with: + base: master + branch: "$BRANCH_NAME" + title: "Upgrade: [dependabot] - bump fhir validator to " + body: "This PR was automatically created by GitHub Actions to update validator versions." + commit-message: "Update validator versions on $BRANCH_NAME" + sign-commits: true