-
Notifications
You must be signed in to change notification settings - Fork 126
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
1 parent
6880844
commit 78d7ddc
Showing
1 changed file
with
3 additions
and
13 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 |
---|---|---|
|
@@ -2,7 +2,6 @@ name: Prettier | |
# minimally modified from https://github.com/creyD/prettier_action#example-2-using-the-only_changed-or-same_commit-option-on-pr | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
|
@@ -16,22 +15,13 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{github.event.pull_request.head.ref}} | ||
repository: ${{github.event.pull_request.head.repo.full_name}} | ||
# Make sure the actual branch is checked out when running on pull requests | ||
ref: ${{ github.head_ref }} | ||
# This is important to fetch the changes to the previous commit | ||
fetch-depth: 0 | ||
|
||
- name: Check if PR is from a fork | ||
id: check_fork | ||
run: echo "::set-output name=is_fork::${{ github.event.pull_request.head.repo.fork }}" | ||
|
||
- name: Prettify code | ||
id: prettify | ||
uses: creyD/[email protected] | ||
with: | ||
prettier_options: --write **/index.html --print-width 200 | ||
commit_message: "chore: prettier" | ||
continue-on-error: true | ||
|
||
- name: Handle commit failure | ||
if: ${{ steps.prettify.outcome == 'failure' && steps.check_fork.outputs.is_fork == 'true' }} | ||
run: echo "Commit failed due to lack of permissions. Please update permissions." |