Skip to content

Commit

Permalink
feat: github actions workflow to fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bo0tzz committed Oct 27, 2024
1 parent 988d527 commit 4d26d6a
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/fix-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Fix formatting

on:
pull_request:
types: [labeled]

jobs:
fix-formatting:
runs-on: ubuntu-latest
if: ${{ github.event.label.name == 'fix:formatting' }}
permissions:
pull-requests: write
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PUSH_O_MATIC_APP_ID }}
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }}

- name: 'Checkout'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ steps.generate-token.outputs.token }}

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: './server/.nvmrc'

- name: Fix formatting
run: make install-all && format-all

- name: Commit and push
uses: EndBug/add-and-commit@v9
with:
message: 'chore: fix formatting'

- name: Remove label
uses: actions/github-script@v7
if: always()
with:
script: |
github.rest.issues.removeLabel({
issue_number: context.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['fix:formatting']
})

0 comments on commit 4d26d6a

Please sign in to comment.