Skip to content

Commit 3440e77

Browse files
committed
Revert "fix: Use GITHUB_WORKFLOW_REF instead of _workflow_version input (#109)"
This reverts commit bdf2970.
1 parent c3ab8b9 commit 3440e77

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

.github/workflows/danger-workflow-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
jobs:
99
danger:
1010
uses: ./.github/workflows/danger.yml
11+
with:
12+
_workflow_version: ${{ github.sha }}
1113

1214
test-outputs:
1315
runs-on: ubuntu-latest

.github/workflows/danger.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Runs DangerJS with a pre-configured set of rules on a Pull Request.
22
on:
33
workflow_call:
4+
inputs:
5+
_workflow_version:
6+
description: 'Internal: specify github-workflows (this repo) revision to use when checking out scripts.'
7+
type: string
8+
required: false
9+
default: v2 # Note: update when publishing a new version
410
outputs:
511
outcome:
612
description: Whether the Danger run finished successfully. Possible values are success, failure, cancelled, or skipped.
@@ -18,10 +24,8 @@ jobs:
1824

1925
- name: Download dangerfile.js and utilities
2026
run: |
21-
# Extract the ref from GITHUB_WORKFLOW_REF (e.g., getsentry/github-workflows/.github/workflows/danger.yml@refs/pull/109/merge -> refs/pull/109/merge)
22-
WORKFLOW_REF=$(echo "${{ github.workflow_ref }}" | sed 's/.*@//')
23-
wget https://raw.githubusercontent.com/getsentry/github-workflows/${WORKFLOW_REF}/danger/dangerfile.js -P ${{ runner.temp }}
24-
wget https://raw.githubusercontent.com/getsentry/github-workflows/${WORKFLOW_REF}/danger/dangerfile-utils.js -P ${{ runner.temp }}
27+
wget https://raw.githubusercontent.com/getsentry/github-workflows/${{ inputs._workflow_version }}/danger/dangerfile.js -P ${{ runner.temp }}
28+
wget https://raw.githubusercontent.com/getsentry/github-workflows/${{ inputs._workflow_version }}/danger/dangerfile-utils.js -P ${{ runner.temp }}
2529
2630
# Using a pre-built docker image in GitHub container registry instaed of NPM to reduce possible attack vectors.
2731
- name: Run DangerJS

.github/workflows/updater.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ on:
3838
type: string
3939
required: false
4040
default: create
41+
_workflow_version:
42+
description: 'Internal: specify github-workflows (this repo) revision to use when checking out scripts.'
43+
type: string
44+
required: false
45+
default: v2 # Note: update when publishing a new version
4146
secrets:
4247
api-token:
4348
required: true
@@ -136,13 +141,11 @@ jobs:
136141
# Note: cannot use `actions/checkout` at the moment because you can't clone outside of the repo root.
137142
# Follow https://github.com/actions/checkout/issues/197
138143
run: |
139-
# Extract the ref from GITHUB_WORKFLOW_REF (e.g., getsentry/github-workflows/.github/workflows/updater.yml@refs/pull/109/merge -> refs/pull/109/merge)
140-
$workflowRef = '${{ github.workflow_ref }}' -replace '.*@', ''
141-
New-Item -ItemType Directory -Force -Path '${{ runner.temp }}/ghwf'
142-
Set-Location '${{ runner.temp }}/ghwf'
144+
mkdir -p ${{ runner.temp }}/ghwf
145+
cd ${{ runner.temp }}/ghwf
143146
git init
144147
git remote add origin https://github.com/getsentry/github-workflows.git
145-
git fetch --depth 1 origin $workflowRef
148+
git fetch --depth 1 origin ${{ inputs._workflow_version }}
146149
git checkout FETCH_HEAD
147150
148151
- name: Update to the latest version

.github/workflows/workflow-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
name: WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE
1313
pattern: '^2\.0\.'
1414
pr-strategy: update
15+
_workflow_version: ${{ github.sha }}
1516
secrets:
1617
api-token: ${{ github.token }}
1718

@@ -22,6 +23,7 @@ jobs:
2223
name: Workflow args test script
2324
runs-on: macos-latest
2425
pattern: '.*'
26+
_workflow_version: ${{ github.sha }}
2527
secrets:
2628
api-token: ${{ github.token }}
2729

0 commit comments

Comments
 (0)