-
Notifications
You must be signed in to change notification settings - Fork 1
Move PR comment creation to separate workflow on:pull_request_target #9
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,61 @@ | ||||||||||
| name: Create PR Comments | ||||||||||
|
|
||||||||||
| on: | ||||||||||
| workflow_run: | ||||||||||
| workflows: ["Tests"] | ||||||||||
| types: [completed] | ||||||||||
|
|
||||||||||
| permissions: | ||||||||||
| contents: read | ||||||||||
| actions: read | ||||||||||
| pull-requests: write | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| pr-comment: | ||||||||||
| name: Post Test Result as PR comment | ||||||||||
| runs-on: ubuntu-24.04 | ||||||||||
| if: github.event.workflow_run.event == 'pull_request' | ||||||||||
|
|
||||||||||
| steps: | ||||||||||
| - name: Download CTRF artifact | ||||||||||
| uses: dawidd6/action-download-artifact@v8 | ||||||||||
| with: | ||||||||||
| github_token: ${{ github.token }} | ||||||||||
| run_id: ${{ github.event.workflow_run.id }} | ||||||||||
| name: ctrf-report | ||||||||||
| path: ctrf | ||||||||||
|
|
||||||||||
| - name: Download PR Number Artifact | ||||||||||
| uses: dawidd6/action-download-artifact@v8 | ||||||||||
| with: | ||||||||||
softworkz marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| github_token: ${{ github.token }} | ||||||||||
| run_id: ${{ github.event.workflow_run.id }} | ||||||||||
| name: pr_number | ||||||||||
| path: pr_number | ||||||||||
|
|
||||||||||
| - name: Read PR Number | ||||||||||
| run: | | ||||||||||
| PR_NUMBER=$(cat pr_number/pr_number.txt | grep -E '^[0-9]+$') | ||||||||||
| if [ -z "$PR_NUMBER" ]; then | ||||||||||
|
Comment on lines
+38
to
+39
|
||||||||||
| PR_NUMBER=$(cat pr_number/pr_number.txt | grep -E '^[0-9]+$') | |
| if [ -z "$PR_NUMBER" ]; then | |
| PR_NUMBER=$(cat pr_number/pr_number.txt | tr -d '\n') | |
| if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then |
Copilot
AI
Nov 17, 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.
[nitpick] The pull-request: true parameter appears redundant when explicitly specifying issue: ${{ env.PR_NUMBER }}. This may cause confusion about whether the action should auto-detect the PR or use the provided issue number. Consider verifying the ctrf-io/github-test-reporter@v1 documentation to confirm if both parameters are needed or if one should be removed.
| pull-request: true |
Copilot
AI
Nov 17, 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.
[nitpick] The pull-request-report: true parameter appears after upload-artifact: false and outside the main parameter block (lines 48-57), which may indicate it's redundant or incorrectly positioned given that pull-request reporting is already enabled via pull-request: true on line 52. Verify if this parameter is necessary or if it should be removed to avoid confusion.
| pull-request-report: true |
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 PR_NUMBER environment variable may not be set when this step runs. The environment variable is set in the previous step (line 190), but the 'run' command in line 194 attempts to use it. Consider using the direct GitHub context value instead:
echo "${{ github.event.pull_request.number }}" > pr_number.txt