-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Read github-token from input instead of env var #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
|
Comment on lines
+39
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Check action.yml structure and entry point
fd -a 'action.ya?ml' -type fRepository: supermodeltools/dead-code-hunter Length of output: 246 🏁 Script executed: # Read action.yml to see what it points to
cat -n action.yml | head -20Repository: supermodeltools/dead-code-hunter Length of output: 775 🏁 Script executed: # Check if dist/index.js exists
fd -a 'index.js' dist/Repository: supermodeltools/dead-code-hunter Length of output: 108 🏁 Script executed: # Look at the full workflow around the dogfood step to see if there's a build
sed -n '1,50p' .github/workflows/ci.yml | cat -nRepository: supermodeltools/dead-code-hunter Length of output: 1206 🏁 Script executed: cat -n action.yml | tail -30Repository: supermodeltools/dead-code-hunter Length of output: 1097 Dogfood job needs to build before testing the action. The Fix this by adding a build step in the dogfood job (same as test job has at line 28: 🤖 Prompt for AI Agents |
||
| supermodel-api-key: ${{ secrets.SUPERMODEL_API_KEY }} | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat -n .github/workflows/ci.yml | head -80Repository: supermodeltools/dead-code-hunter
Length of output: 1206
🏁 Script executed:
Repository: supermodeltools/dead-code-hunter
Length of output: 1337
Skip dogfood job on forked PRs—secrets won't be available.
Here's the issue: when someone opens a PR from a forked repo, GitHub Actions intentionally blocks access to secrets as a security measure. So
secrets.SUPERMODEL_API_KEYbecomes empty.Your action requires that API key (see
required: truein action.yml), so the job will crash immediately when the secret is empty. To avoid cluttering CI with failures you can't fix, skip the dogfood job when running on forked PRs.The condition below works because it says: "run this job if it's a push event OR if it's a PR from the main repo (not a fork)":
🛠️ Suggested guard
dogfood: name: Self-test (dogfood) runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false permissions: contents: read pull-requests: write📝 Committable suggestion
🤖 Prompt for AI Agents