Skip to content

chore(deps): update actions/checkout action to v4.1.7 #64

chore(deps): update actions/checkout action to v4.1.7

chore(deps): update actions/checkout action to v4.1.7 #64

name: Update Formula
on:
pull_request:
paths:
- .github/workflows/update-formula.yml
jobs:
update-sha:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: Download Knope Source
run: curl -o source.tgz https://codeload.github.com/knope-dev/knope/tar.gz/refs/tags/knope/v0.16.2
- name: Get new SHA
run: echo "NEW_SHA=$(shasum -a 256 source.tgz | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Update Formula
id: update-formula
run: sed -i "s#^ sha256 .*# sha256 \"${{ env.NEW_SHA }}\"#" Formula/knope.rb
- name: Check if SHA changed
id: check-sha
run: echo "changed=$(git diff --exit-code Formula/knope.rb > /dev/null && echo no || echo yes)" >> $GITHUB_OUTPUT
- name: Commit back new SHA if it changed
if: steps.check-sha.outputs.changed == 'yes'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git switch -C release
git add Formula/knope.rb
git commit --amend --reuse-message HEAD
git push --force --set-upstream origin release
- name: Open a new PR
if: steps.check-sha.outputs.changed == 'yes'
run: gh pr create --fill --label "release"
env:
GH_TOKEN: ${{ secrets.PAT }}