You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci: refactor PR commenting to use dedicated workflow
Split PR comment functionality into a separate reusable workflow to
eliminate security risks associated with using `pull_request_target`
event.
The new approach works as follows:
- Source workflows upload comment message as artifacts
- A dedicated `pr-comment` workflow downloads the artifact
- Comments are posted using the safer `workflow_run` event trigger
This provides a better security isolation by ensuring PR comment
workflows run in the context of the base branch rather than the potentially
untrusted PR branch.
Benefits:
- Eliminates `pull_request_target` event security risks
- Centralizes PR commenting logic for consistency
Addresses #2287
Signed-off-by: vprashar2929 <[email protected]>
Copy file name to clipboardExpand all lines: .github/workflows/profiling.yaml
+11-16Lines changed: 11 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,6 @@
1
1
name: Profiling Report
2
2
on:
3
-
pull_request_target:
4
-
5
-
permissions:
6
-
contents: write
7
-
pull-requests: write
3
+
pull_request:
8
4
9
5
jobs:
10
6
profiling:
@@ -109,7 +105,7 @@ jobs:
109
105
path: ./tmp/*
110
106
retention-days: 5# Keep artifact for 5 days
111
107
112
-
comment_on_pr:
108
+
generate-comment-message:
113
109
runs-on: ubuntu-latest
114
110
needs: [profiling]
115
111
steps:
@@ -132,11 +128,9 @@ jobs:
132
128
path: ./tmp
133
129
134
130
- name: Generate comment messages
135
-
id: generate_message
136
131
run: |
137
132
{
138
-
echo "message<<EOF"
139
-
./hack/reports/profiling.sh output
133
+
./hack/reports/profiling.sh output | awk 'NR >4'
140
134
echo ""
141
135
echo "⬇️ Download the Profiling artifacts from the [Actions Summary page](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
0 commit comments