@@ -111,30 +111,21 @@ jobs:
111
111
- name : Check out workflow scripts
112
112
# Note: cannot use `actions/checkout` at the moment because you can't clone outside of the repo root.
113
113
# Follow https://github.com/actions/checkout/issues/197
114
- env :
115
- RUNNER_TEMP : ${{ runner.temp }}
116
- WORKFLOW_VERSION : ${{ inputs._workflow_version }}
117
114
run : |
118
- mkdir -p "$RUNNER_TEMP /ghwf"
119
- cd "$RUNNER_TEMP /ghwf"
115
+ mkdir -p ${{ runner.temp }} /ghwf
116
+ cd ${{ runner.temp }} /ghwf
120
117
git init
121
118
git remote add origin https://github.com/getsentry/github-workflows.git
122
- git fetch --depth 1 origin "$WORKFLOW_VERSION"
119
+ git fetch --depth 1 origin ${{ inputs._workflow_version }}
123
120
git checkout FETCH_HEAD
124
121
125
122
- name : Update to the latest version
126
123
id : target
127
- env :
128
- RUNNER_TEMP : ${{ runner.temp }}
129
- INPUT_PATH : ${{ inputs.path }}
130
- INPUT_PATTERN : ${{ inputs.pattern }}
131
- run : " $env:RUNNER_TEMP/ghwf/updater/scripts/update-dependency.ps1" -Path "$env:INPUT_PATH" -Pattern "$env:INPUT_PATTERN"
124
+ run : ${{ runner.temp }}/ghwf/updater/scripts/update-dependency.ps1 -Path '${{ inputs.path }}' -Pattern '${{ inputs.pattern }}'
132
125
133
126
- name : Get the base repo info
134
127
if : steps.target.outputs.latestTag != steps.target.outputs.originalTag
135
128
id : root
136
- env :
137
- RUNNER_TEMP : ${{ runner.temp }}
138
129
run : |
139
130
$mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value
140
131
$prBranch = switch ('${{ inputs.pr-strategy }}')
@@ -145,7 +136,7 @@ jobs:
145
136
}
146
137
"baseBranch=$mainBranch" | Tee-Object $env:GITHUB_OUTPUT -Append
147
138
"prBranch=$prBranch" | Tee-Object $env:GITHUB_OUTPUT -Append
148
- $nonBotCommits = "$env:RUNNER_TEMP /ghwf/updater/scripts/nonbot-commits.ps1" `
139
+ $nonBotCommits = ${{ runner.temp }} /ghwf/updater/scripts/nonbot-commits.ps1 `
149
140
-RepoUrl "$(git config --get remote.origin.url)" -PrBranch $prBranch -MainBranch $mainBranch
150
141
$changed = $nonBotCommits.Length -gt 0 ? 'true' : 'false'
151
142
"changed=$changed" | Tee-Object $env:GITHUB_OUTPUT -Append
@@ -159,10 +150,8 @@ jobs:
159
150
id : existing-pr
160
151
env :
161
152
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
162
- GITHUB_REPOSITORY : ${{ github.repository }}
163
- GITHUB_REPOSITORY_OWNER : ${{ github.repository_owner }}
164
153
run : |
165
- $urls = @(gh api " repos/$GITHUB_REPOSITORY /pulls?base=${{ steps.root.outputs.baseBranch }}&head=$GITHUB_REPOSITORY_OWNER :${{ steps.root.outputs.prBranch }}" --jq '.[].html_url')
154
+ $urls = @(gh api ' repos/${{ github.repository }} /pulls?base=${{ steps.root.outputs.baseBranch }}&head=${{ github.repository_owner }} :${{ steps.root.outputs.prBranch }}' --jq '.[].html_url')
166
155
if ($urls.Length -eq 0)
167
156
{
168
157
"url=" | Tee-Object $env:GITHUB_OUTPUT -Append
@@ -181,17 +170,12 @@ jobs:
181
170
182
171
- name : Get target changelog
183
172
if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
184
- env :
185
- RUNNER_TEMP : ${{ runner.temp }}
186
- TARGET_URL : ${{ steps.target.outputs.url }}
187
- ORIGINAL_TAG : ${{ steps.target.outputs.originalTag }}
188
- LATEST_TAG : ${{ steps.target.outputs.latestTag }}
189
173
run : |
190
- $changelog = "$env:RUNNER_TEMP /ghwf/updater/scripts/get-changelog.ps1" `
191
- -RepoUrl "$env:TARGET_URL" `
192
- -OldTag "$env:ORIGINAL_TAG" `
193
- -NewTag "$env:LATEST_TAG"
194
- "$env:RUNNER_TEMP /ghwf/updater/scripts/set-github-env.ps1" TARGET_CHANGELOG $changelog
174
+ $changelog = ${{ runner.temp }} /ghwf/updater/scripts/get-changelog.ps1 `
175
+ -RepoUrl '${{ steps.target.outputs.url }}' `
176
+ -OldTag '${{ steps.target.outputs.originalTag }}' `
177
+ -NewTag '${{ steps.target.outputs.latestTag }}'
178
+ ${{ runner.temp }} /ghwf/updater/scripts/set-github-env.ps1 TARGET_CHANGELOG $changelog
195
179
196
180
# First we create a PR only if it doesn't exist. We will later overwrite the content with the same action.
197
181
- name : Create a PR
@@ -239,32 +223,19 @@ jobs:
239
223
240
224
- name : ' After new PR: redo the update'
241
225
if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }}
242
- env :
243
- RUNNER_TEMP : ${{ runner.temp }}
244
- INPUT_PATH : ${{ inputs.path }}
245
- LATEST_TAG : ${{ steps.target.outputs.latestTag }}
246
- run : " $env:RUNNER_TEMP/ghwf/updater/scripts/update-dependency.ps1" -Path "$env:INPUT_PATH" -Tag "$env:LATEST_TAG"
226
+ run : ${{ runner.temp }}/ghwf/updater/scripts/update-dependency.ps1 -Path '${{ inputs.path }}' -Tag '${{ steps.target.outputs.latestTag }}'
247
227
248
228
- name : Update Changelog
249
229
if : ${{ inputs.changelog-entry && ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
250
- env :
251
- RUNNER_TEMP : ${{ runner.temp }}
252
- INPUT_NAME : ${{ inputs.name }}
253
- PR_URL : ${{ steps.pr.outputs.url }}
254
- TARGET_URL : ${{ steps.target.outputs.url }}
255
- MAIN_BRANCH : ${{ steps.target.outputs.mainBranch }}
256
- ORIGINAL_TAG : ${{ steps.target.outputs.originalTag }}
257
- LATEST_TAG : ${{ steps.target.outputs.latestTag }}
258
- CHANGELOG_SECTION : ${{ inputs.changelog-section }}
259
230
run : |
260
- "$env:RUNNER_TEMP /ghwf/updater/scripts/update-changelog.ps1" `
261
- -Name "$env:INPUT_NAME" `
262
- -PR "$env:PR_URL" `
263
- -RepoUrl "$env:TARGET_URL" `
264
- -MainBranch "$env:MAIN_BRANCH" `
265
- -OldTag "$env:ORIGINAL_TAG" `
266
- -NewTag "$env:LATEST_TAG" `
267
- -Section "$env:CHANGELOG_SECTION"
231
+ ${{ runner.temp }} /ghwf/updater/scripts/update-changelog.ps1 `
232
+ -Name '${{ inputs.name }}' `
233
+ -PR '${{ steps.pr.outputs.url }}' `
234
+ -RepoUrl '${{ steps.target.outputs.url }}' `
235
+ -MainBranch '${{ steps.target.outputs.mainBranch }}' `
236
+ -OldTag '${{ steps.target.outputs.originalTag }}' `
237
+ -NewTag '${{ steps.target.outputs.latestTag }}' `
238
+ -Section '${{ inputs.changelog-section }}'
268
239
269
240
- run : git --no-pager diff
270
241
if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
0 commit comments