-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example GitHub workflow for automated update PRs (#167)
* Add GitHub workflow for automated update PRs * Add docs * Revert auto-formatting of block titles
- Loading branch information
Showing
3 changed files
with
107 additions
and
30 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,68 @@ | ||
# This workflow compares a downstream azimuth-config repository for a specific site with the upstream | ||
# stackhpc/azimuth-config repository to check whether there is a new upstream version available. If a | ||
# newer tag is found in the upstream repository then a pull request is created to the downstream repo | ||
# in order to merge in the changes from the new upstream release. | ||
|
||
# To use this workflow in a downstream azimuth-config repository simply copy it into .github/workflows | ||
# and give it an appropriate name, e.g. | ||
# cp .github-upgrade-check.yml.sample .github/workflows/upgrade-check.yml | ||
|
||
name: Check for upstream updates | ||
on: | ||
schedule: | ||
- cron: "0 9 * * *" | ||
workflow_dispatch: | ||
jobs: | ||
check_for_update: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
|
||
- name: Checkout the config repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
# Based on equivalent GitLab CI job | ||
- name: Check for new release | ||
shell: bash | ||
run: | | ||
set -xe | ||
|
||
# Install dependency | ||
apt update && apt install -y git-crypt | ||
|
||
# Tell git who we are for commits | ||
git config user.email "${{ github.actor }}-ci@azimuth.ci" | ||
git config user.name "${{ github.actor }} CI" | ||
|
||
# Create the merge branch and write vars to .mergeenv file | ||
./bin/create-merge-branch | ||
|
||
- name: Set release tag output | ||
id: release_tag | ||
if: ${{ hashFiles('.mergeenv') }} | ||
run: source .mergeenv && echo value=$RELEASE_TAG >> $GITHUB_OUTPUT | ||
|
||
- name: Set branch name output | ||
id: branch_name | ||
if: ${{ hashFiles('.mergeenv') }} | ||
run: source .mergeenv && echo value=$BRANCH_NAME >> $GITHUB_OUTPUT | ||
|
||
- name: Remove tmp file | ||
run: rm .mergeenv | ||
if: ${{ hashFiles('.mergeenv') }} | ||
|
||
- name: Create Pull Request | ||
if: ${{ steps.release_tag.outputs.value }} | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
base: main | ||
branch: ${{ steps.branch_name.outputs.value }} | ||
title: "Upgrade Azimuth to ${{ steps.release_tag.outputs.value }}" | ||
body: This PR was automatically generated by GitHub Actions. | ||
commit-message: "Upgrade Azimuth to ${{ steps.release_tag.outputs.value }}" | ||
delete-branch: true |
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
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