Skip to content

Commit

Permalink
Update monitor-homebrew.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
arezaii authored Jan 6, 2025
1 parent 7835d1e commit 4084888
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/monitor-homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,34 @@ 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: |
if ! cmp -s hb_master_chapel.rb util/packaging/homebrew/chapel-release.rb; then
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 "[email protected]"
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 }}

0 comments on commit 4084888

Please sign in to comment.