Repository navigation
91 lines (81 loc) · 4.02 KB
/
Copy pathupgrade.yml
File metadata and controls
91 lines (81 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Upgrade gh-aw
# This is a plain (non-gh-aw) workflow: keeps the gh-aw CLI version pin
# (.github/aw/gh-aw-version), the compiler's action-version pins
# (.github/aw/actions-lock.json), and the compiled `*.lock.yml` files all
# in sync on a schedule. No fork-guard or bot-role check is needed here —
# schedule/workflow_dispatch events only ever run in this repo's own
# context, with no untrusted event payload to gate against.
#
# Renovate must not touch .github/workflows/*.lock.yml or
# .github/aw/actions-lock.json directly (see README's Roadmap) — those
# files are compiler output, and this workflow is the intended,
# compiler-aware way they change. The App used below already needs
# `workflows: write` on its installation, same as drafter.md/fix.md
# already require to push lock-file changes (see README's setup
# checklist).
on:
schedule:
- cron: "25 7 * * 1" # Weekly, Monday 07:25 UTC; avoids the hourly stampede.
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
upgrade:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Generate App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.GH_AW_APP_CLIENT_ID }}
private-key: ${{ secrets.GH_AW_APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
token: ${{ steps.app-token.outputs.token }}
- name: Install latest gh-aw and update the version pin
id: install
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
set -euo pipefail
# Deliberately unpinned here: discovering the latest version is
# this workflow's job. ci.yml and `just setup` always pin to
# whatever ends up in .github/aw/gh-aw-version, which this step
# now updates, so both stay in sync with what gets compiled below.
gh extension install --force github/gh-aw
version=$(gh aw version 2>&1 | awk '{print $NF}')
echo "Installed gh-aw ${version}"
printf '%s\n' "$version" >.github/aw/gh-aw-version
echo "version=${version}" >>"$GITHUB_OUTPUT"
- name: Update action-version pins and recompile all workflows
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
set -euo pipefail
# --no-compile: compile as its own step below, so a failure there
# is clearly attributable to compilation, not the upgrade itself.
gh aw upgrade --no-compile --approve
# No workflow-id arguments, unlike ci.yml/justfile: compiles every
# .md file under .github/workflows, so a new pipeline stage never
# needs this workflow updated to know about it.
gh aw compile --approve
- name: Open or update a pull request with the results
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7
with:
token: ${{ steps.app-token.outputs.token }}
commit-message: "build: Upgrade gh-aw to ${{ steps.install.outputs.version }}"
title: "build: Upgrade gh-aw to ${{ steps.install.outputs.version }}"
body: |
Automated upgrade, opened by `.github/workflows/upgrade.yml`:
- Bumped `.github/aw/gh-aw-version` to `${{ steps.install.outputs.version }}`.
- Refreshed action-version pins in `.github/aw/actions-lock.json`.
- Recompiled all `*.lock.yml` files against the new version.
Safe to merge once `check-drift` passes; no manual review is
needed beyond that unless the CLI upgrade changed compiler
behavior in a way worth double-checking.
branch: automation/upgrade-gh-aw
committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"