-
Notifications
You must be signed in to change notification settings - Fork 9
ci: improve test comment #258
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 | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | |||||||||||||||||||||||||||||||||||||||||||||||
| name: PR Test Summary | |||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||||||||||||||||||||
| workflow_run: | |||||||||||||||||||||||||||||||||||||||||||||||
| workflows: | |||||||||||||||||||||||||||||||||||||||||||||||
| - Test Python Package | |||||||||||||||||||||||||||||||||||||||||||||||
| types: | |||||||||||||||||||||||||||||||||||||||||||||||
| - completed | |||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | |||||||||||||||||||||||||||||||||||||||||||||||
| actions: read | |||||||||||||||||||||||||||||||||||||||||||||||
| checks: write | |||||||||||||||||||||||||||||||||||||||||||||||
| pull-requests: write | |||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||||||||||||||||||||
| report: | |||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||||||||||||||||||||
| - name: Download test report | |||||||||||||||||||||||||||||||||||||||||||||||
| uses: dawidd6/action-download-artifact@v14 | |||||||||||||||||||||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||||||||||||||||||||
| name: test-results | |||||||||||||||||||||||||||||||||||||||||||||||
| workflow: ${{ github.event.workflow_run.workflow_id }} | |||||||||||||||||||||||||||||||||||||||||||||||
| run_id: ${{ github.event.workflow_run.id }} | |||||||||||||||||||||||||||||||||||||||||||||||
|
hfudev marked this conversation as resolved.
|
|||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||
| - name: Read PR number | |||||||||||||||||||||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||||||||||||||||||||
| if [ -f pr_number.txt ]; then | |||||||||||||||||||||||||||||||||||||||||||||||
| echo "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENV | |||||||||||||||||||||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||||||||||||||||||||
| echo "pr_number.txt not found, skipping comment." | |||||||||||||||||||||||||||||||||||||||||||||||
| exit 0 | |||||||||||||||||||||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+33
Check failureCode scanning / CodeQL Environment variable built from user-controlled sources Critical
Potential environment variable injection in
if [ -f pr_number.txt ]; thenecho "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENVelseecho "pr_number.txt not found, skipping comment."exit 0fi Error loading related location Loading workflow_run Error loading related location Loading
Copilot AutofixAI about 1 month ago In general, the fix is to prevent arbitrary content from The best minimal fix here, without changing the workflow’s overall behavior, is to read Concretely, in
No external dependencies are needed; we can use standard POSIX tools (
Suggested changeset
1
.github/workflows/pr-test-summary.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||
| - name: Comment on PR | |||||||||||||||||||||||||||||||||||||||||||||||
| uses: MishaKav/pytest-coverage-comment@v1 | |||||||||||||||||||||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||||||||||||||||||||
| pytest-coverage-path: ./pytest-coverage.txt | |||||||||||||||||||||||||||||||||||||||||||||||
| junitxml-path: ./pytest.xml | |||||||||||||||||||||||||||||||||||||||||||||||
| issue-number: ${{ env.PR_NUMBER }} | |||||||||||||||||||||||||||||||||||||||||||||||
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.
This workflow triggers on all completed runs of “Test Build IDF Apps”, including
pushruns onmain. Since the artifact is only uploaded forpull_requestruns, the download/comment steps will fail for push-triggered runs. Add a guard (e.g. job/stepif: github.event.workflow_run.event == 'pull_request') or otherwise skip when the upstream run wasn’t a PR.