-
Notifications
You must be signed in to change notification settings - Fork 2
legg til reusable knip action #326
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Slett forrige kommentar fra Knip | ||
| if: github.event.pull_request.number | ||
| shell: bash | ||
| continue-on-error: true | ||
| run: gh pr comment ${{ github.event.pull_request.number }} --delete-last --yes | ||
| env: | ||
| GITHUB_TOKEN: ${{ inputs.github-token }} | ||
|
|
||
| - name: Post Knip rapport | ||
| if: github.event.pull_request.number | ||
| shell: bash | ||
| run: | | ||
| number_of_words=$(wc -w < knip-report.md) | ||
| if [ $number_of_words -gt 3 ]; then | ||
| gh pr comment ${{ github.event.pull_request.number }} --body-file knip-report.md | ||
| fi | ||
| env: | ||
| GITHUB_TOKEN: ${{ inputs.github-token }} | ||
|
|
Copilot
AI
Nov 27, 2025
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.
The --delete-last flag deletes the last comment by any user on the PR, not just comments from this action. This could accidentally delete unrelated comments. Consider using a comment identifier or marker to target only Knip comments, or use a dedicated action like marocchino/sticky-pull-request-comment that can update/replace specific comments.
| - name: Slett forrige kommentar fra Knip | |
| if: github.event.pull_request.number | |
| shell: bash | |
| continue-on-error: true | |
| run: gh pr comment ${{ github.event.pull_request.number }} --delete-last --yes | |
| env: | |
| GITHUB_TOKEN: ${{ inputs.github-token }} | |
| - name: Post Knip rapport | |
| if: github.event.pull_request.number | |
| shell: bash | |
| run: | | |
| number_of_words=$(wc -w < knip-report.md) | |
| if [ $number_of_words -gt 3 ]; then | |
| gh pr comment ${{ github.event.pull_request.number }} --body-file knip-report.md | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ inputs.github-token }} | |
| - name: Post/oppdater Knip rapport | |
| if: github.event.pull_request.number | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: knip-report | |
| path: knip-report.md | |
| GITHUB_TOKEN: ${{ inputs.github-token }} |
| - name: Slett forrige kommentar fra Knip | ||
| if: github.event.pull_request.number |
Copilot
AI
Nov 27, 2025
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.
The condition github.event.pull_request.number evaluates to true even when the number is 0 (which shouldn't occur but is safer to guard against). Use github.event.pull_request.number != '' or github.event_name == 'pull_request' for more robust checking.
| required: false | ||
| type: string | ||
| description: Hvilken package manager en skal bruke (npm|pnpm|yarn) | ||
| description: Hvilken package manager en skal brukes (pnpm|yarn). |
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.
Grammatikk :P
har testet at den funker her:
https://github.com/navikt/fp-frontend/actions/runs/19733664478/job/56540378914