-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: optimize prettier actions (#223)
* Prevent GitHub actions running twice on same event Fixes #221 * style: add new lines between actions steps for readability * ci: upgrade node version * ci: better branches syntax * style: rm extra space in action step * ci: skip installing dependencies The package.json is anyway not in the root so it always failed. It might be good to add it again after all source code is moved to the root. See #211 * ci: upgrade setup-node to v4 * ci: upgrade checkout to v4
- Loading branch information
Showing
2 changed files
with
24 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
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 |
---|---|---|
|
@@ -19,33 +19,39 @@ jobs: | |
uses: xt0rted/pull-request-comment-branch@v2 | ||
if: github.event_name == 'issue_comment' | ||
id: comment-branch | ||
|
||
- name: Checkout Pull Request head ref | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
if: github.event_name == 'issue_comment' | ||
with: | ||
ref: ${{ steps.comment-branch.outputs.head_ref }} | ||
|
||
- name: Checkout default head ref | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
if: github.event_name != 'issue_comment' | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '14' | ||
- name: Install dependencies | ||
run: npm install | ||
node-version: "22" | ||
|
||
- name: Configure GitHub Actions bot | ||
run : | | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
- name: Run Prettier | ||
id: prettier | ||
run: npx prettier --config .prettierrc --write "**/*.{js,jsx,ts,tsx,html,css,scss}" | ||
|
||
- name: Commit changes | ||
run: | | ||
git diff --exit-code || git commit -am "bot: apply Prettier formatting" | ||
- name: Push changes | ||
run: | | ||
git push | ||
- name: Comment reaction | ||
if: github.event_name == 'issue_comment' | ||
uses: dkershner6/[email protected] | ||
|