From dbccca7429ebf497d754d4d5a2358efe08bb3a7b Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Mon, 19 Aug 2024 15:31:33 +0900 Subject: [PATCH 1/3] fix: added knip reported and removed target trigger --- .github/workflows/cypress-testing.yml | 3 +- .github/workflows/knip-reporter.yml | 49 +++++++++++++++++++++++++++ .github/workflows/knip.yml | 25 ++++++++------ 3 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/knip-reporter.yml diff --git a/.github/workflows/cypress-testing.yml b/.github/workflows/cypress-testing.yml index 26e3d6b..5e60c05 100644 --- a/.github/workflows/cypress-testing.yml +++ b/.github/workflows/cypress-testing.yml @@ -1,8 +1,7 @@ name: Run Cypress testing suite on: workflow_dispatch: - pull_request_target: - types: [opened, synchronize] + pull_request: jobs: cypress-run: diff --git a/.github/workflows/knip-reporter.yml b/.github/workflows/knip-reporter.yml new file mode 100644 index 0000000..1b0be66 --- /dev/null +++ b/.github/workflows/knip-reporter.yml @@ -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 }} diff --git a/.github/workflows/knip.yml b/.github/workflows/knip.yml index 63c4474..90f47e5 100644 --- a/.github/workflows/knip.yml +++ b/.github/workflows/knip.yml @@ -1,10 +1,7 @@ name: Knip on: - pull_request_target: - types: [ opened, synchronize ] - -permissions: write-all + pull_request: jobs: run-knip: @@ -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 From 92d7388e707f8b9085bfc59e0502ecc5e67e2a52 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Mon, 19 Aug 2024 15:36:43 +0900 Subject: [PATCH 2/3] chore: fixed cspell --- .cspell.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.cspell.json b/.cspell.json index d220b84..90fd04d 100644 --- a/.cspell.json +++ b/.cspell.json @@ -35,7 +35,8 @@ "WXDAI", "XDAI", "xmark", - "SUPABASE" + "SUPABASE", + "wfzpewmlyiozupulbuur" ], "dictionaries": ["typescript", "node", "software-terms", "html"], "import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"], From d727bfe6cbf562fe1fc8c4150b87fe7233b975e4 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Mon, 19 Aug 2024 15:41:33 +0900 Subject: [PATCH 3/3] chore: fixed knip --- knip.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/knip.ts b/knip.ts index dd6d8bd..5818010 100644 --- a/knip.ts +++ b/knip.ts @@ -9,7 +9,6 @@ const config: KnipConfig = { "libsodium-wrappers", "eslint-config-prettier", "eslint-plugin-prettier", - "@ethersproject/providers", "@octokit/core", "@octokit/plugin-create-or-update-text-file", "@octokit/rest", @@ -17,6 +16,8 @@ const config: KnipConfig = { "@uniswap/permit2-sdk", "ethers", "yaml", + "@supabase/supabase-js", + "@ubiquibot/configuration", ], };