Skip to content

Commit

Permalink
Github Action running "pnpm format"
Browse files Browse the repository at this point in the history
  • Loading branch information
VojtechVitek committed Nov 4, 2024
1 parent 61cbf8f commit 9c5f067
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
File renamed without changes.
36 changes: 36 additions & 0 deletions .github/workflows/pnpm-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pnpm format

on:
workflow_call:

jobs:
run:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 20

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false

- run: pnpm format

- name: Commit back
uses: 0xsequence/actions/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN_GIT_COMMIT }}
with:
files: "**/*.js **/*.ts"
branch: ${{ github.head_ref }}
commit_message: "[AUTOMATED] pnpm format"
23 changes: 23 additions & 0 deletions .github/workflows/pr:pnpm-format-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: pnpm-format-label

on:
pull_request:
types: [labeled]

jobs:
proto:
if: ${{ github.event.label.name == 'pnpm format' }}
uses: ./.github/workflows/pnpm-format.yml
secrets: inherit

rm:
if: ${{ github.event.label.name == 'pnpm format' }}
runs-on: ubuntu-latest
steps:
- name: Remove the label
run: |
LABEL=$(echo "${{ github.event.label.name }}" | sed 's/ /%20/g')
curl -X DELETE \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/$LABEL

0 comments on commit 9c5f067

Please sign in to comment.