diff --git a/.github/workflows/monitor-homebrew.yml b/.github/workflows/monitor-homebrew.yml index f0235dafeb0f..a205c61e07bc 100644 --- a/.github/workflows/monitor-homebrew.yml +++ b/.github/workflows/monitor-homebrew.yml @@ -16,6 +16,11 @@ jobs: - name: Fetch released version of Chapel formula run: | curl -o hb_master_chapel.rb https://raw.githubusercontent.com/homebrew/homebrew-core/master/Formula/c/chapel.rb + FILE_HASH=$(sha256sum hb_master_chapel.rb | awk '{ print $1 }') + HASH_SUBSTRING=${FILE_HASH:0:7} + echo "FILE_HASH=$FILE_HASH" >> $GITHUB_ENV + echo "HASH_SUBSTRING=$HASH_SUBSTRING" >> $GITHUB_ENV + - name: Compare the released version with the chapel-release.rb id: compare run: | @@ -23,20 +28,22 @@ jobs: echo "file_changed=true" >> $GITHUB_ENV else echo "file_changed=false" >> $GITHUB_ENV - fi + fi + - name: Create a new branch if file has changed if: ${{ env.file_changed == 'true' }} run: | git config --global user.email "github-action-bot@email.com" git config --global user.name "github action" - git checkout -b update-chapel-homebrew-release + git checkout -b update-chapel-homebrew-release-${{ env.HASH_SUBSTRING }} mv hb_master_chapel.rb util/packaging/homebrew/chapel-release.rb git add util/packaging/homebrew/chapel-release.rb git commit -m "Update chapel-main.rb with changes from chapel.rb" git push --set-upstream origin update-chapel-homebrew-release - echo "Homebrew has updated the formula!" + echo "Homebrew has updated the formula!" + - name: create pull request - run: gh pr create -B main -H update-chapel-homebrew-release --title 'Update our copy of the released Homebrew formula' --body 'Created by Github action' + run: gh pr create -B main -H update-chapel-homebrew-release-${{ env.HASH_SUBSTRING }} --title 'Update our copy of the released Homebrew formula' --body 'Created by Github action' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}