Skip to content

Commit 9cb32c9

Browse files
Merge branch 'main' into lz/ext-danger
2 parents 7703d7b + 0d0d99a commit 9cb32c9

File tree

8 files changed

+468
-15
lines changed

8 files changed

+468
-15
lines changed

.github/workflows/update-deps.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Update dependencies
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run weekly on Mondays at 8:00 UTC
7+
- cron: '0 8 * * 1'
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
danger:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: getsentry/github-workflows/updater@main
18+
with:
19+
path: danger/danger.properties
20+
name: Danger JS
21+
api-token: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,29 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Updater - Add `post-update-script` input parameter to run custom scripts after dependency updates ([#130](https://github.com/getsentry/github-workflows/pull/130), [#133](https://github.com/getsentry/github-workflows/pull/133))
8+
- Scripts receive original and new version as arguments
9+
- Support both bash (`.sh`) and PowerShell (`.ps1`) scripts
10+
- Enables workflows like updating lock files, running code generators, or modifying configuration files
11+
- Updater - Add SSH key support and comprehensive authentication validation ([#134](https://github.com/getsentry/github-workflows/pull/134))
12+
- Add `ssh-key` input parameter for deploy key authentication
13+
- Support using both `ssh-key` (for git) and `api-token` (for GitHub API) together
14+
- Add detailed token validation with actionable error messages
15+
- Detect common token issues: expiration, whitespace, SSH keys in wrong input, missing scopes
16+
- Validate SSH key format when provided
17+
518
### Fixes
619

720
- Updater - Fix boolean input handling for `changelog-entry` parameter and add input validation ([#127](https://github.com/getsentry/github-workflows/pull/127))
21+
- Updater - Fix cryptic authentication errors with better validation and error messages ([#134](https://github.com/getsentry/github-workflows/pull/134), closes [#128](https://github.com/getsentry/github-workflows/issues/128))
22+
23+
### Dependencies
24+
25+
- Bump Danger JS from v11.3.1 to v13.0.4 ([#132](https://github.com/getsentry/github-workflows/pull/132))
26+
- [changelog](https://github.com/danger/danger-js/blob/main/CHANGELOG.md#1304)
27+
- [diff](https://github.com/danger/danger-js/compare/11.3.1...13.0.4)
828

929
## 3.0.0
1030

@@ -27,6 +47,7 @@
2747
- Updater and Danger reusable workflows are now composite actions ([#114](https://github.com/getsentry/github-workflows/pull/114))
2848

2949
To update your existing Updater workflows:
50+
3051
```yaml
3152
### Before
3253
native:
@@ -38,7 +59,7 @@
3859
# If a custom token is used instead, a CI would be triggered on a created PR.
3960
api-token: ${{ secrets.CI_DEPLOY_KEY }}
4061
41-
### After
62+
### After (v3.0)
4263
native:
4364
runs-on: ubuntu-latest
4465
steps:
@@ -49,7 +70,23 @@
4970
api-token: ${{ secrets.CI_DEPLOY_KEY }}
5071
```
5172

73+
**Note**: If you were using SSH deploy keys with the v2 reusable workflow, the v3.0 composite action initially only supported tokens.
74+
SSH key support was restored in v3.1 ([#134](https://github.com/getsentry/github-workflows/pull/134)). To use SSH keys, update to v3.1+ and use the `ssh-key` input:
75+
76+
```yaml
77+
### With SSH key (v3.1+)
78+
native:
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: getsentry/github-workflows/updater@v3
82+
with:
83+
path: scripts/update-sentry-native-ndk.sh
84+
name: Native SDK
85+
ssh-key: ${{ secrets.CI_DEPLOY_KEY }}
86+
```
87+
5288
To update your existing Danger workflows:
89+
5390
```yaml
5491
### Before
5592
danger:

danger/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ runs:
2626
token: ${{ inputs.api-token }}
2727
fetch-depth: 0
2828

29+
# Read the Danger version from the properties file
30+
- name: Get Danger version
31+
id: config
32+
shell: pwsh
33+
run: Get-Content '${{ github.action_path }}/danger.properties' | Tee-Object $env:GITHUB_OUTPUT -Append
34+
2935
# Using a pre-built docker image in GitHub container registry instead of NPM to reduce possible attack vectors.
3036
- name: Run DangerJS
3137
id: danger
@@ -41,5 +47,5 @@ runs:
4147
-e GITHUB_TOKEN="${{ inputs.api-token }}" \
4248
-e DANGER_DISABLE_TRANSPILATION="true" \
4349
-e EXTRA_DANGERFILE_INPUT="${{ inputs.extra-dangerfile }}" \
44-
ghcr.io/danger/danger-js:13.0.1 \
50+
ghcr.io/danger/danger-js:${{ steps.config.outputs.version }} \
4551
--failOnErrors --dangerfile ${{ github.action_path }}/dangerfile.js

danger/danger.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version=13.0.4
2+
repo=https://github.com/danger/danger-js

updater/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,18 @@ jobs:
9595
target-branch: v7
9696
pattern: '^1\.' # Limit to major version '1'
9797
api-token: ${{ secrets.CI_DEPLOY_KEY }}
98+
99+
# Use a post-update script (sh or ps1) to make additional changes after dependency update
100+
# The script receives two arguments: original version and new version
101+
post-update-script:
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: getsentry/github-workflows/updater@v3
105+
with:
106+
path: modules/sentry-cocoa
107+
name: Cocoa SDK
108+
post-update-script: scripts/post-update.sh # Receives args: $1=old version, $2=new version
109+
api-token: ${{ secrets.CI_DEPLOY_KEY }}
98110
```
99111
100112
## Inputs
@@ -135,12 +147,45 @@ jobs:
135147
* type: string
136148
* required: false
137149
* default: '' (uses repository default branch)
150+
* `post-update-script`: Optional script to run after successful dependency update. Can be a bash script (`.sh`) or PowerShell script (`.ps1`). The script will be executed in the repository root directory before PR creation. The script receives two arguments:
151+
* `$1` / `$args[0]` - The original version (version before update)
152+
* `$2` / `$args[1]` - The new version (version after update)
153+
* type: string
154+
* required: false
155+
* default: ''
138156
* `api-token`: Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`.
139157
If you provide the usual `${{ github.token }}`, no followup CI will run on the created PR.
140158
If you want CI to run on the PRs created by the Updater, you need to provide custom user-specific auth token.
141159
* type: string
142160
* required: true
143161

162+
### Post-Update Script Example
163+
164+
**Bash script** (`scripts/post-update.sh`):
165+
166+
```bash
167+
#!/usr/bin/env bash
168+
set -euo pipefail
169+
170+
ORIGINAL_VERSION="$1"
171+
NEW_VERSION="$2"
172+
173+
echo "Updated from $ORIGINAL_VERSION to $NEW_VERSION"
174+
# Make additional changes to repository files here
175+
```
176+
177+
**PowerShell script** (`scripts/post-update.ps1`):
178+
179+
```powershell
180+
param(
181+
[Parameter(Mandatory = $true)][string] $OriginalVersion,
182+
[Parameter(Mandatory = $true)][string] $NewVersion
183+
)
184+
185+
Write-Output "Updated from $OriginalVersion to $NewVersion"
186+
# Make additional changes to repository files here
187+
```
188+
144189
## Outputs
145190

146191
* `prUrl`: The created/updated PR's URL.

0 commit comments

Comments
 (0)