Check manual dependencies #114
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: Check manual dependencies | |
on: | |
schedule: | |
- cron: "25 3 4 * *" # monthly: At 03:25 on day-of-month 4 | |
workflow_dispatch: # Allow manual run | |
jobs: | |
check-dependencies: | |
runs-on: ubuntu-latest | |
outputs: | |
check-outcome: ${{ steps.check.outcome }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check versions of manually managed dependencies | |
id: check | |
# We want to be able to react, if the check fails due to a new version. | |
continue-on-error: true | |
run: | | |
./release/100-check-latest-versions.sh | |
create-pull-request: | |
runs-on: ubuntu-latest | |
needs: check-dependencies | |
if: ${{ needs.check-dependencies.outputs.check-outcome == 'failure' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.NEW_PULL_REQUEST_KEY }} | |
- name: Create changes | |
run: | | |
./release/101-save-latest-versions.sh | |
# Extract newly added lines in diff and combine into commit message part | |
CHANGED_VERSIONS="$(git diff | grep -e '^\+[^\+]' | sed 's/^+//g' | paste -sd ',' | sed 's/,/, /g')" | |
CHANGED_VERSIONS_BRANCH="autoupdate/$(echo "$CHANGED_VERSIONS" | sed 's/, /_/g' | sed 's/ /-/g')" | |
echo "CHANGED_VERSIONS=$CHANGED_VERSIONS" >> $GITHUB_ENV | |
echo "CHANGED_VERSIONS_BRANCH=$CHANGED_VERSIONS_BRANCH" >> $GITHUB_ENV | |
- name: Create Pull Request and conditionally auto-merge | |
uses: peter-evans/create-pull-request@v6 | |
id: pull-request | |
with: | |
title: "[AutoUpdate] ${{ env.CHANGED_VERSIONS }}" | |
commit-message: "[AutoUpdate] ${{ env.CHANGED_VERSIONS }}" | |
branch: ${{ env.CHANGED_VERSIONS_BRANCH }} | |
delete-branch: true | |
body: | | |
New versions of one or more dependencies were found and combined into this pull request. | |
If there are notable changes in the dependencies' changelogs, then please create a new release. | |
- name: Automatically merge when tests pass | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
pull-request-number: ${{ steps.pull-request.outputs.pull-request-number }} |