diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5074bc0..50de5c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,3 +26,18 @@ jobs: - name: Build run: npm run build + + dogfood: + name: Self-test (dogfood) + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v4 + + - name: Run Dead Code Hunter on itself + uses: ./ + with: + supermodel-api-key: ${{ secrets.SUPERMODEL_API_KEY }} + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/dist/index.js b/dist/index.js index 78bf4a6..aba9b31 100644 --- a/dist/index.js +++ b/dist/index.js @@ -32621,7 +32621,7 @@ async function run() { core.setOutput('dead-code-json', JSON.stringify(deadCode)); // Step 6: Post PR comment if enabled if (commentOnPr && github.context.payload.pull_request) { - const token = process.env.GITHUB_TOKEN; + const token = core.getInput('github-token') || process.env.GITHUB_TOKEN; if (token) { const octokit = github.getOctokit(token); const comment = (0, dead_code_1.formatPrComment)(deadCode); diff --git a/src/index.ts b/src/index.ts index 2cf6f09..f9d35f3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -172,7 +172,7 @@ async function run(): Promise { // Step 6: Post PR comment if enabled if (commentOnPr && github.context.payload.pull_request) { - const token = process.env.GITHUB_TOKEN; + const token = core.getInput('github-token') || process.env.GITHUB_TOKEN; if (token) { const octokit = github.getOctokit(token); const comment = formatPrComment(deadCode);