Skip to content

Commit

Permalink
don't run formatbot against forks
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar authored Aug 27, 2024
1 parent 2c12aec commit 581f112
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/formatbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,35 @@ jobs:
if: github.event.pull_request.draft == false

steps:
- name: Determine if fork
id: check_fork
run: |
if [ "${{ github.event.pull_request.head.repo.full_name }}" = "${{ github.repository }}" ]; then
echo "is_fork=false" >> $GITHUB_OUTPUT
else
echo "is_fork=true" >> $GITHUB_OUTPUT
fi
- name: Checkout code
uses: actions/checkout@v3
if: steps.check_fork.outputs.is_fork == 'false'
with:
token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}


- name: Setup Node.js
uses: actions/setup-node@v3
if: steps.check_fork.outputs.is_fork == 'false'
with:
node-version: "20"

- run: npm install

- name: Run formatter
if: steps.check_fork.outputs.is_fork == 'false'
run: npx prettier -w .

- name: Commit changes
if: steps.check_fork.outputs.is_fork == 'false'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "formatbot: Automatically format code"
Expand Down

0 comments on commit 581f112

Please sign in to comment.