Skip to content

Commit

Permalink
fix: action
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfrosty committed Nov 26, 2024
1 parent 5e92757 commit 96ea62e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/prettier-label-action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Prettier Formatting on Label

env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Explicitly set permissions
permissions:
contents: write
pull-requests: write

on:
pull_request:
Expand All @@ -16,9 +18,12 @@ jobs:
# Checkout the PR branch
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# Use a token that allows pushing to the PR branch
# Use the full PR head reference
ref: ${{ github.event.pull_request.head.ref }}
# Use the full repository name
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

# Setup Node.js (required for Prettier)
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -47,7 +52,7 @@ jobs:
git config --local user.name "GitHub Action"
git add .
git commit -m "[chore] automatic prettier formatting"
git push
git push origin HEAD:${{ github.event.pull_request.head.ref }}
# Remove the label after formatting
- name: Remove formatting label
Expand Down

0 comments on commit 96ea62e

Please sign in to comment.