Skip to content

Commit 1949ea0

Browse files
authored
Revert "Improve GitHub Actions workflows with environment variable handling (#89)" (#97)
* Revert "Improve GitHub Actions workflows with environment variable handling (#89)" This reverts commit 831aefe. * chore: changelog
1 parent b82c559 commit 1949ea0

File tree

4 files changed

+33
-66
lines changed

4 files changed

+33
-66
lines changed

.github/workflows/danger.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,19 @@ jobs:
2323
fetch-depth: 0
2424

2525
- name: Download dangerfile.js
26-
env:
27-
WORKFLOW_VERSION: ${{ inputs._workflow_version }}
28-
RUNNER_TEMP: ${{ runner.temp }}
29-
run: wget "https://raw.githubusercontent.com/getsentry/github-workflows/$WORKFLOW_VERSION/danger/dangerfile.js" -P "$RUNNER_TEMP"
26+
run: wget https://raw.githubusercontent.com/getsentry/github-workflows/${{ inputs._workflow_version }}/danger/dangerfile.js -P ${{ runner.temp }}
3027

3128
# Using a pre-built docker image in GitHub container registry instaed of NPM to reduce possible attack vectors.
3229
- name: Run DangerJS
3330
id: danger
34-
env:
35-
GITHUB_WORKSPACE: ${{ github.workspace }}
36-
RUNNER_TEMP: ${{ runner.temp }}
37-
GITHUB_TOKEN: ${{ github.token }}
3831
run: |
3932
docker run \
40-
--volume "$GITHUB_WORKSPACE":/github/workspace \
41-
--volume "$RUNNER_TEMP":"$RUNNER_TEMP" \
33+
--volume ${{ github.workspace }}:/github/workspace \
34+
--volume ${{ runner.temp }}:${{ runner.temp }} \
4235
--workdir /github/workspace \
4336
--user $UID \
4437
-e "INPUT_ARGS" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true \
45-
-e GITHUB_TOKEN="$GITHUB_TOKEN" \
38+
-e GITHUB_TOKEN="${{ github.token }}" \
4639
-e DANGER_DISABLE_TRANSPILATION="true" \
4740
ghcr.io/danger/danger-js:11.3.1 \
48-
--failOnErrors --dangerfile "$RUNNER_TEMP"/dangerfile.js
41+
--failOnErrors --dangerfile ${{ runner.temp }}/dangerfile.js

.github/workflows/updater.yml

Lines changed: 20 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -111,30 +111,21 @@ jobs:
111111
- name: Check out workflow scripts
112112
# Note: cannot use `actions/checkout` at the moment because you can't clone outside of the repo root.
113113
# Follow https://github.com/actions/checkout/issues/197
114-
env:
115-
RUNNER_TEMP: ${{ runner.temp }}
116-
WORKFLOW_VERSION: ${{ inputs._workflow_version }}
117114
run: |
118-
mkdir -p "$RUNNER_TEMP/ghwf"
119-
cd "$RUNNER_TEMP/ghwf"
115+
mkdir -p ${{ runner.temp }}/ghwf
116+
cd ${{ runner.temp }}/ghwf
120117
git init
121118
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 }}
123120
git checkout FETCH_HEAD
124121
125122
- name: Update to the latest version
126123
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 }}'
132125

133126
- name: Get the base repo info
134127
if: steps.target.outputs.latestTag != steps.target.outputs.originalTag
135128
id: root
136-
env:
137-
RUNNER_TEMP: ${{ runner.temp }}
138129
run: |
139130
$mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value
140131
$prBranch = switch ('${{ inputs.pr-strategy }}')
@@ -145,7 +136,7 @@ jobs:
145136
}
146137
"baseBranch=$mainBranch" | Tee-Object $env:GITHUB_OUTPUT -Append
147138
"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 `
149140
-RepoUrl "$(git config --get remote.origin.url)" -PrBranch $prBranch -MainBranch $mainBranch
150141
$changed = $nonBotCommits.Length -gt 0 ? 'true' : 'false'
151142
"changed=$changed" | Tee-Object $env:GITHUB_OUTPUT -Append
@@ -159,10 +150,8 @@ jobs:
159150
id: existing-pr
160151
env:
161152
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
162-
GITHUB_REPOSITORY: ${{ github.repository }}
163-
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
164153
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')
166155
if ($urls.Length -eq 0)
167156
{
168157
"url=" | Tee-Object $env:GITHUB_OUTPUT -Append
@@ -181,17 +170,12 @@ jobs:
181170

182171
- name: Get target changelog
183172
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 }}
189173
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
195179
196180
# First we create a PR only if it doesn't exist. We will later overwrite the content with the same action.
197181
- name: Create a PR
@@ -239,32 +223,19 @@ jobs:
239223

240224
- name: 'After new PR: redo the update'
241225
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 }}'
247227

248228
- name: Update Changelog
249229
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 }}
259230
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 }}'
268239
269240
- run: git --no-pager diff
270241
if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2.13.1
4+
5+
### Fixes
6+
7+
- Updater - invalid workflow syntax - reverts recent switch to env vars ([#97](https://github.com/getsentry/github-workflows/pull/97))
8+
39
## 2.13.0
410

511
### Features

sentry-cli/integration-test/action.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ runs:
1616
steps:
1717
- name: Run tests
1818
shell: pwsh
19-
env:
20-
GITHUB_ACTION_PATH: ${{ github.action_path }}
21-
INPUT_PATH: ${{ inputs.path }}
2219
run: |
23-
Import-Module -Name "$env:GITHUB_ACTION_PATH/action.psm1" -Force
24-
Invoke-Pester -Output Detailed "$env:INPUT_PATH"
20+
Import-Module -Name ${{ github.action_path }}/action.psm1 -Force
21+
Invoke-Pester -Output Detailed '${{ inputs.path }}'

0 commit comments

Comments
 (0)