You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Updater and Danger reusable workflows are now composite actions ([#114](https://github.com/getsentry/github-workflows/pull/114))
28
48
29
49
To update your existing Updater workflows:
50
+
30
51
```yaml
31
52
### Before
32
53
native:
@@ -38,7 +59,7 @@
38
59
# If a custom token is used instead, a CI would be triggered on a created PR.
39
60
api-token: ${{ secrets.CI_DEPLOY_KEY }}
40
61
41
-
### After
62
+
### After (v3.0)
42
63
native:
43
64
runs-on: ubuntu-latest
44
65
steps:
@@ -49,7 +70,23 @@
49
70
api-token: ${{ secrets.CI_DEPLOY_KEY }}
50
71
```
51
72
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:
Copy file name to clipboardExpand all lines: updater/README.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,6 +95,18 @@ jobs:
95
95
target-branch: v7
96
96
pattern: '^1\.'# Limit to major version '1'
97
97
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 }}
98
110
```
99
111
100
112
## Inputs
@@ -135,12 +147,45 @@ jobs:
135
147
* type: string
136
148
* required: false
137
149
* 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: ''
138
156
* `api-token`: Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`.
139
157
If you provide the usual `${{ github.token }}`, no followup CI will run on the created PR.
140
158
If you want CI to run on the PRs created by the Updater, you need to provide custom user-specific auth token.
141
159
* type: string
142
160
* required: true
143
161
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
description: 'Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
38
-
required: true
37
+
description: 'Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}. Not required if ssh-key is provided, but can be used together with ssh-key for GitHub API operations.'
38
+
required: false
39
+
default: ''
40
+
ssh-key:
41
+
description: 'SSH private key for repository authentication. Can be used alone or together with api-token (SSH for git, token for GitHub API).'
42
+
required: false
43
+
default: ''
44
+
post-update-script:
45
+
description: '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 caller-repo directory before PR creation.'
46
+
required: false
47
+
default: ''
39
48
40
49
outputs:
41
50
prUrl:
@@ -102,6 +111,127 @@ runs:
102
111
}
103
112
Write-Output "✓ PR strategy value '${{ inputs.pr-strategy }}' is valid"
104
113
114
+
- name: Validate post-update-script
115
+
if: ${{ inputs.post-update-script != '' }}
116
+
shell: pwsh
117
+
run: |
118
+
# Validate that inputs.post-update-script contains only safe characters
119
+
if ('${{ inputs.post-update-script }}' -notmatch '^[a-zA-Z0-9_\./#\s-]+$') {
120
+
Write-Output "::error::Invalid post-update-script path: '${{ inputs.post-update-script }}'. Only alphanumeric characters, spaces, and _-./# are allowed."
121
+
exit 1
122
+
}
123
+
Write-Output "✓ Post-update script path '${{ inputs.post-update-script }}' is valid"
Write-Output "::warning::Token has no scopes. If using a fine-grained PAT, ensure it has Contents (write) and Pull Requests (write) permissions."
185
+
} else {
186
+
Write-Output "Token scopes: $scopes"
187
+
if ($scopes -notmatch '\brepo\b' -and $scopes -notmatch '\bpublic_repo\b') {
188
+
Write-Output "::warning::Token may be missing 'repo' or 'public_repo' scope. This may cause issues with private repositories."
189
+
}
190
+
}
191
+
} else {
192
+
Write-Output "::notice::Could not detect token scopes (this is normal for fine-grained PATs). Ensure token has Contents (write) and Pull Requests (write) permissions."
193
+
}
194
+
195
+
# Check token validity and access
196
+
gh api repos/${{ github.repository }} --silent 2>&1 | Out-Null
0 commit comments