Skip to content

Commit

Permalink
Merge pull request #23 from gentlementlegen/fix/pull-request-action
Browse files Browse the repository at this point in the history
fix: pull request action
  • Loading branch information
gentlementlegen authored Aug 19, 2024
2 parents 902ff2b + bc08606 commit 572de16
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 13 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"WXDAI",
"XDAI",
"xmark",
"wfzpewmlyiozupulbuur",
"SUPABASE",
"Knip"
],
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/cypress-testing.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Run Cypress testing suite
on:
workflow_dispatch:
pull_request_target:
types: [opened, synchronize]
pull_request:

jobs:
cypress-run:
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/knip-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Knip-reporter

on:
workflow_run:
workflows: ["Knip"]
types:
- completed

jobs:
knip-reporter:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install toolchain
run: yarn install

- uses: actions/download-artifact@v4
with:
name: knip-results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Read pr number
id: pr-number
uses: juliangruber/read-file-action@v1
with:
path: ./pr-number.txt
trim: true

- name: Report knip results to pull request
uses: gitcoindev/knip-reporter@main
with:
verbose: true
comment_id: ${{ github.workflow }}-reporter
command_script_name: knip-ci
annotations: true
ignore_results: false
json_input: true
json_input_file_name: knip-results.json
pull_request_number: ${{ steps.pr-number.outputs.content }}
token: ${{ secrets.GITHUB_TOKEN }}
25 changes: 14 additions & 11 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Knip

on:
pull_request_target:
types: [opened, synchronize]

permissions: write-all
pull_request:

jobs:
run-knip:
Expand All @@ -21,11 +18,17 @@ jobs:
- name: Install toolchain
run: yarn install

- name: Report knip results to pull request
uses: Codex-/knip-reporter@v2
- name: Store PR number
run: echo ${{ github.event.number }} > pr-number.txt

- name: Run Knip
run: yarn knip || yarn -s knip --reporter json > knip-results.json

- name: Upload knip result
if: failure()
uses: actions/upload-artifact@v4
with:
verbose: true
comment_id: ${{ github.workflow }}-reporter
command_script_name: knip-ci
annotations: true
ignore_results: false
name: knip-results
path: |
knip-results.json
pr-number.txt

0 comments on commit 572de16

Please sign in to comment.