[workflow] auto-commit disabled for PR commits
Something has changed, either in GitHub, the checkout action, or the auto-commit action. Commits in PRs can no longer be checked and have their formatting auto-commited back (at least using this method) without running into permission issues. I've modified the workflow to simply error when formatting has not been run in a PR branch. The auto-commit still runs on commits to develop.
This commit is contained in:
@@ -19,8 +19,6 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.BYPASS_WORKFLOW_PAT || github.token }}
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
@@ -33,7 +31,17 @@ jobs:
|
||||
- name: CSharpier Format
|
||||
run: csharpier format .
|
||||
|
||||
- name: Auto Commit Changes
|
||||
- name: Check PR Formatting
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
if [[ -n $(git status --porcelain) ]]; then
|
||||
echo "::error::Code formatting issues found. Please run 'csharpier format .' locally and push the changes to your PR branch. Read the `README.md` file for more information."
|
||||
git status --porcelain
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Auto Commit Changes (Push)
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: stefanzweifel/git-auto-commit-action@v6
|
||||
with:
|
||||
commit_message: .NET Format Style Fixes
|
||||
|
||||
Reference in New Issue
Block a user