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
BEFORE_VERSION=$(gh aw version | awk '{print $NF}')
233
+
echo "Before version: $BEFORE_VERSION"
235
234
```
236
235
236
+
3. Upgrade the gh-aw extension:
237
+
238
+
```bash
239
+
gh extension upgrade github/gh-aw --force
240
+
```
241
+
242
+
4. Record the **after** version:
243
+
244
+
```bash
245
+
AFTER_VERSION=$(gh aw version | awk '{print $NF}')
246
+
echo "After version: $AFTER_VERSION"
247
+
```
248
+
249
+
5. Compare versions:
250
+
- If versions are identical **and** `$FORCE_INPUT` is not `true`: report "gh-aw is already on the latest version. No upgrade needed." and **stop**.
251
+
- If versions differ or force is `true`: continue to step 6.
252
+
253
+
6. Run the upgrade and create a PR using the native gh-aw flag:
254
+
255
+
```bash
256
+
gh aw upgrade --create-pull-request --verbose
257
+
```
258
+
259
+
This handles branch creation, recompilation, commit, and PR creation in one command.
260
+
261
+
7. Report the result: before version, after version, and the PR URL if one was created.
262
+
263
+
## Edge Cases
264
+
265
+
- If `gh aw upgrade --create-pull-request` reports no changes, it will not create a PR. Report "No workflow changes after upgrade. Repo is already current." and stop.
266
+
- If the upgrade fails, report the error output clearly and stop.
267
+
- If a PR already exists from a previous run, gh-aw will update it or skip — this is safe to re-run.
268
+
````
269
+
237
270
#### Key considerations:
238
271
239
272
1. **`gh aw upgrade --create-pull-request`** is the native flag — it handles
@@ -244,14 +277,14 @@ jobs:
244
277
provisioning via GPM, use a GitHub App token with `contents: write` and
245
278
`pull-requests: write` on target repos.
246
279
247
-
3. **GPM provisioning**: This workflow YAML can be deployed across repos using
280
+
3. **GPM provisioning**: This workflow `.md` can be deployed across repos using
248
281
the GPM `gpm-workflows-deploy` skill. Add it to gpm-config.yml under
249
-
`workflows:` and GPM will push it to all managed repos.
282
+
`workflows:` and GPM will push it to all managed repos. Then run
283
+
`gh aw compile` in each repo to produce the `.lock.yml`.
250
284
251
-
4. **Alternative: gh-aw native workflow**: Write this as a gh-aw `.md`
252
-
workflow that triggers on schedule, uses bash tools to run `gh extension
253
-
upgrade` and `gh aw upgrade --create-pull-request`. This keeps the
254
-
automation within the gh-aw ecosystem.
285
+
4. **Compilation**: After writing the `.md` file, run `gh aw compile` to
286
+
produce `.github/workflows/gh-aw-upgrade.lock.yml`. The `.lock.yml` is
287
+
what GitHub Actions executes — never edit it directly.
255
288
256
289
5. **Branch naming**: `gh aw upgrade --create-pull-request` creates its own
257
290
branch name. Check `gh aw upgrade --help` for any `--branch` flag in
@@ -260,4 +293,8 @@ jobs:
260
293
6. **Idempotency**: The workflow is safe to re-run. If no changes result
261
294
from `gh aw upgrade`, no PR is created. If a PR already exists, gh-aw
262
295
will update it or skip.
296
+
297
+
7. **Auto-merge**: There is no `merge-pull-request` safe-output in gh-aw.
298
+
If auto-merge is needed, add `post-steps` with an App token to merge
0 commit comments