Skip to content

Commit

Permalink
chore: switch knip workflow to workflow_run
Browse files Browse the repository at this point in the history
  • Loading branch information
gitcoindev committed Mar 19, 2024
1 parent 87cd2a8 commit 193a5d7
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Knip

on:
pull_request:
workflow_run:
workflows: ["Build"]
types:
- completed

permissions:
checks: write
Expand All @@ -11,8 +14,27 @@ jobs:
run-knip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Download artifact'
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "static"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/static.zip', Buffer.from(download.data));
- run: unzip static.zip

- name: Setup Node
uses: actions/setup-node@v4
Expand Down
23 changes: 23 additions & 0 deletions how
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
commit 87cd2a88a2350d6a33783828558f597aa3402e18 (HEAD -> knip-configuration-for-keygen)
Author: Korrrba <[email protected]>
Date: Tue Mar 19 15:45:50 2024 +0100

chore: remove workflow_dispatch, restrict write permissions to checks and issues for knip workflow

diff --git a/.github/workflows/knip.yml b/.github/workflows/knip.yml
index b686ba2..811280d 100644
--- a/.github/workflows/knip.yml
+++ b/.github/workflows/knip.yml
@@ -2,9 +2,10 @@ name: Knip

on:
pull_request:
- workflow_dispatch:

-permissions: write-all
+permissions:
+ checks: write
+ issues: write

jobs:
run-knip:

0 comments on commit 193a5d7

Please sign in to comment.