generated from NHSDigital/api-management-service-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github action to update validator version
- Loading branch information
1 parent
0fbdf9d
commit b3e71b1
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
with: | ||
base: master | ||
branch: "$BRANCH_NAME" | ||
title: "Upgrade: [dependabot] - bump fhir validator to <NEW 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 |