Skip to content

Commit c36902a

Browse files
vaindclaude
andcommitted
Use GITHUB_WORKFLOW_REF instead of _workflow_version input
Automatically determines the workflow reference from GITHUB_WORKFLOW_REF instead of requiring manual _workflow_version input parameter. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 55c7e95 commit c36902a

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

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

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

1412
test-outputs:
1513
runs-on: ubuntu-latest

.github/workflows/danger.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
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
104
outputs:
115
outcome:
126
description: Whether the Danger run finished successfully. Possible values are success, failure, cancelled, or skipped.
@@ -24,9 +18,10 @@ jobs:
2418

2519
- name: Download dangerfile.js and utilities
2620
run: |
27-
printenv
28-
wget https://raw.githubusercontent.com/getsentry/github-workflows/${{ inputs._workflow_version }}/danger/dangerfile.js -P ${{ runner.temp }}
29-
wget https://raw.githubusercontent.com/getsentry/github-workflows/${{ inputs._workflow_version }}/danger/dangerfile-utils.js -P ${{ runner.temp }}
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 }}
3025
3126
# Using a pre-built docker image in GitHub container registry instaed of NPM to reduce possible attack vectors.
3227
- name: Run DangerJS

0 commit comments

Comments
 (0)