Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/danger-workflow-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
jobs:
danger:
uses: ./.github/workflows/danger.yml
with:
_workflow_version: ${{ github.sha }}

test-outputs:
runs-on: ubuntu-latest
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# Runs DangerJS with a pre-configured set of rules on a Pull Request.
on:
workflow_call:
inputs:
_workflow_version:
description: 'Internal: specify github-workflows (this repo) revision to use when checking out scripts.'
type: string
required: false
default: v2 # Note: update when publishing a new version
outputs:
outcome:
description: Whether the Danger run finished successfully. Possible values are success, failure, cancelled, or skipped.
Expand All @@ -24,8 +18,10 @@ jobs:

- name: Download dangerfile.js and utilities
run: |
wget https://raw.githubusercontent.com/getsentry/github-workflows/${{ inputs._workflow_version }}/danger/dangerfile.js -P ${{ runner.temp }}
wget https://raw.githubusercontent.com/getsentry/github-workflows/${{ inputs._workflow_version }}/danger/dangerfile-utils.js -P ${{ runner.temp }}
# Extract the ref from GITHUB_WORKFLOW_REF (e.g., getsentry/github-workflows/.github/workflows/danger.yml@refs/pull/109/merge -> refs/pull/109/merge)
WORKFLOW_REF=$(echo "${{ github.workflow_ref }}" | sed 's/.*@//')
wget https://raw.githubusercontent.com/getsentry/github-workflows/${WORKFLOW_REF}/danger/dangerfile.js -P ${{ runner.temp }}
wget https://raw.githubusercontent.com/getsentry/github-workflows/${WORKFLOW_REF}/danger/dangerfile-utils.js -P ${{ runner.temp }}

# Using a pre-built docker image in GitHub container registry instaed of NPM to reduce possible attack vectors.
- name: Run DangerJS
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ on:
type: string
required: false
default: create
_workflow_version:
description: 'Internal: specify github-workflows (this repo) revision to use when checking out scripts.'
type: string
required: false
default: v2 # Note: update when publishing a new version
secrets:
api-token:
required: true
Expand Down Expand Up @@ -141,11 +136,13 @@ jobs:
# Note: cannot use `actions/checkout` at the moment because you can't clone outside of the repo root.
# Follow https://github.com/actions/checkout/issues/197
run: |
mkdir -p ${{ runner.temp }}/ghwf
cd ${{ runner.temp }}/ghwf
# Extract the ref from GITHUB_WORKFLOW_REF (e.g., getsentry/github-workflows/.github/workflows/updater.yml@refs/pull/109/merge -> refs/pull/109/merge)
$workflowRef = '${{ github.workflow_ref }}' -replace '.*@', ''
New-Item -ItemType Directory -Force -Path '${{ runner.temp }}/ghwf'
Set-Location '${{ runner.temp }}/ghwf'
git init
git remote add origin https://github.com/getsentry/github-workflows.git
git fetch --depth 1 origin ${{ inputs._workflow_version }}
git fetch --depth 1 origin $workflowRef
git checkout FETCH_HEAD

- name: Update to the latest version
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/workflow-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
name: WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE
pattern: '^2\.0\.'
pr-strategy: update
_workflow_version: ${{ github.sha }}
secrets:
api-token: ${{ github.token }}

Expand All @@ -23,7 +22,6 @@ jobs:
name: Workflow args test script
runs-on: macos-latest
pattern: '.*'
_workflow_version: ${{ github.sha }}
secrets:
api-token: ${{ github.token }}

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Use GITHUB_WORKFLOW_REF instead of _workflow_version input parameter to automatically determine workflow script versions ([#109](https://github.com/getsentry/github-workflows/pull/109))

## 2.14.0

### Features
Expand Down
Loading