Skip to content

Commit

Permalink
Update java-autoformat.yml
Browse files Browse the repository at this point in the history
Changed branch name to be unique and fail task on master PRs
  • Loading branch information
charlestian23 committed Mar 29, 2024
1 parent 211fab1 commit 4a71b39
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/java-autoformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ jobs:
git config --global user.name 'Bram van Heuveln'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git checkout -b auto-format-code
git push --set-upstream origin auto-format-code
branch_name="auto-format-code-$(date +%s)"
git checkout -b $branch_name
git push --set-upstream origin $branch_name
git add .
git diff --cached --exit-code || git commit -am "Automated Java code formatting changes" && git push
Expand All @@ -47,6 +48,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Must approve auto-format pull request
run: |
echo "Please review and approve the appropriate auto-format-code pull request."
exit 1
format_other_branches:
if: |
github.event.pull_request.base.ref == 'dev' &&
Expand Down

0 comments on commit 4a71b39

Please sign in to comment.