@@ -9,10 +9,7 @@ defaults:
99 shell : bash
1010
1111permissions :
12- contents : write
13- issues : read
14- pull-requests : write
15- checks : write
12+ contents : read
1613
1714jobs :
1815 assign-hip-number :
@@ -82,11 +79,12 @@ jobs:
8279
8380 - name : Assign HIP Number
8481 if : steps.check-new.outputs.new-hip == 'true'
82+ env :
83+ PR_NUMBER : ${{ github.event.pull_request.number }}
84+ HIP_FILES : ${{ steps.check-new.outputs.hip-files }}
8585 run : |
86- # Extract the current PR number
87- PR_NUMBER=${{ github.event.pull_request.number }}
8886 HIP_HEADER="hip: $PR_NUMBER"
89- HIP_FILE=$(echo "${{ steps.check-new.outputs.hip-files }} " | head -n 1)
87+ HIP_FILE=$(echo "$HIP_FILES " | head -n 1)
9088
9189 echo "Assigning HIP number to file: $HIP_FILE"
9290
@@ -99,10 +97,11 @@ jobs:
9997
10098 - name : Rename HIP File
10199 if : steps.check-new.outputs.new-hip == 'true'
100+ env :
101+ PR_NUMBER : ${{ github.event.pull_request.number }}
102+ HIP_FILES : ${{ steps.check-new.outputs.hip-files }}
102103 run : |
103- # Extract PR number
104- PR_NUMBER=${{ github.event.pull_request.number }}
105- HIP_FILE=$(echo "${{ steps.check-new.outputs.hip-files }}" | head -n 1)
104+ HIP_FILE=$(echo "$HIP_FILES" | head -n 1)
106105
107106 if [ -z "$HIP_FILE" ]; then
108107 echo "No HIP file found to rename. Skipping rename."
@@ -122,11 +121,13 @@ jobs:
122121
123122 - name : Commit Changes
124123 if : steps.check-new.outputs.new-hip == 'true'
124+ env :
125+ PR_NUMBER : ${{ github.event.pull_request.number }}
126+ HEAD_REF : ${{ github.head_ref }}
125127 run : |
126128 git config --global user.name 'GitHub Action'
127129 git config --global user.email 'action@github.com'
128130
129- PR_NUMBER=${{ github.event.pull_request.number }}
130131 git add HIP/
131132
132133 # Check if there are changes to commit
@@ -140,7 +141,7 @@ jobs:
140141 exit 0
141142 }
142143
143- git push origin HEAD:${{ github.head_ref }} || {
144+ git push origin " HEAD:$HEAD_REF" || {
144145 echo "Push failed. This is expected for PRs from forks without write access."
145146 echo "The PR author will need to manually update their branch."
146147 exit 0
0 commit comments