Formatter run by @arnavjagia #6
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
name: "Prettier Format" | |
run-name: Formatter run by @${{ github.actor }} | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
branches: [prod, dev] | |
jobs: | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- run: npm i -D prettier@latest | |
- run: npx prettier . --write | |
# Building a multiline commit message | |
- run: 'echo "chore: apply formatting changes" >> commitmessage.txt' | |
- run: echo "[skip vercel]" >> commitmessage.txt | |
# Create a multiline string to be used by the git-auto-commit Action | |
- name: Set commit message | |
id: commit_message_step | |
run: | | |
echo 'commit_message<<EOF' >> $GITHUB_OUTPUT | |
cat commitmessage.txt >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
# Quick and dirty step to get rid of the temporary file holding the commit message | |
- run: rm -rf commitmessage.txt | |
# Commit changes | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v5.0.1 | |
with: | |
commit_message: ${{ steps.commit_message_step.outputs.commit_message }} | |
branch: ${{ github.head_ref }} |