forked from rust-bitcoin/rust-bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (40 loc) · 2.14 KB
/
cron-weekly-update-cargo-semver-checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Update cargo-semver-checks
on:
schedule:
- cron: "0 0 * * 6" # runs every Saturday at 00:00
workflow_dispatch: # allows manual triggering
jobs:
format:
name: Update cargo-semver-checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update semver-checks to use latest crates.io published version
run: |
set -x
# Grab the latest version of cargo semver-checks from crates.io
# that is not yanked.
LATEST_VERSION=$(curl --proto '=https' --tlsv1.3 -sSf https://crates.io/api/v1/crates/cargo-semver-checks/versions | jq -r 'first( .versions[] | select(.yanked == false) ) | .num')
# Update the latest version in the reference file.
echo "${LATEST_VERSION}" > ./.github/workflows/cargo-semver-checks-version
echo "cargo_semver_checks_version=${LATEST_VERSION}" >> $GITHUB_ENV
# If somehow the latest version has not changed. In this case don't make an empty PR.
if ! git diff --exit-code > /dev/null; then
echo "Updated cargo-semver-checks. Opening PR."
echo "changes_made=true" >> $GITHUB_ENV
else
echo "Attempted to update cargo-semver-checks but the crates.io version did not change. Not opening any PR."
echo "changes_made=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes_made == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
author: Update cargo-semver-checks Bot <[email protected]>
committer: Update cargo-semver-checks Bot <[email protected]>
title: Automated weekly update to cargo-semver-checks (to ${{ env.cargo_semver_checks_version }})
body: |
Automated update to Github CI workflow `semver-checks.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
commit-message: Automated update to Github CI to cargo-semver-checks version-${{ env.cargo_semver_checks_version }}
branch: create-pull-request/weekly-cargo-semver-checks-update