forked from chapel-lang/chapel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }} | ||
|