Repository navigation
101 lines (91 loc) · 3.93 KB
/
Copy pathsquad-gh-aw-hosted-e2e.yml
File metadata and controls
101 lines (91 loc) · 3.93 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
92
93
94
95
96
97
98
99
100
101
name: Squad gh-aw hosted E2E
# This controller is intentionally available only through repository_dispatch,
# which GitHub loads from the default branch. The squad-gh-aw-e2e environment
# must additionally restrict deployment branches to the protected `dev` branch.
# Configure these environment variables:
# - SQUAD_GH_AW_E2E_TARGET_REPOSITORY (canonical owner/name)
# - SQUAD_GH_AW_E2E_TARGET_REPOSITORY_ID (numeric repository ID)
# - SQUAD_GH_AW_E2E_TARGET_OWNER_ID (numeric owner ID)
# - SQUAD_GH_AW_E2E_PAT_ACTOR_LOGIN and SQUAD_GH_AW_E2E_PAT_ACTOR_ID
# The SQUAD_GH_AW_E2E_TOKEN secret is scoped only to that one public consumer.
on:
repository_dispatch:
types: [squad-gh-aw-hosted-e2e]
permissions:
contents: read
concurrency:
group: squad-gh-aw-hosted-e2e
cancel-in-progress: false
jobs:
hosted-e2e:
name: Install, merge, bootstrap, and probe
# Bound to the immutable repository ID of github/squad rather than its name, so a
# rename or transfer reaches source-preflight and fails loudly instead of skipping.
if: >-
github.repository_id == '1151205052'
&& github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
timeout-minutes: 45
environment: squad-gh-aw-e2e
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 #v6
with:
node-version: 22
cache: npm
- name: Install trusted controller dependencies
run: |
npm config set registry "https://packagefeedproxy.microsoft.io/npm/"
npm ci --ignore-scripts
- name: Install pinned gh-aw
env:
GH_TOKEN: ${{ github.token }}
run: |
gh extension install --force --pin v0.91.5 github/gh-aw
test "$(gh aw --version 2>&1 | awk '{print $NF}')" = v0.91.5
- name: Verify trusted default-branch controller
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
npm run gh-aw:integrity:check
node scripts/gh-aw-hosted-e2e.mjs source-preflight \
--source-repository "$GITHUB_REPOSITORY" \
--source-repository-id "$GITHUB_REPOSITORY_ID" \
--source-ref "$GITHUB_REF" \
--source-sha "$GITHUB_SHA"
test -z "$(git status --porcelain --untracked-files=no)"
- name: Run trusted hosted journey
env:
GH_TOKEN: ${{ secrets.SQUAD_GH_AW_E2E_TOKEN }}
TARGET_REPOSITORY: ${{ vars.SQUAD_GH_AW_E2E_TARGET_REPOSITORY }}
TARGET_REPOSITORY_ID: ${{ vars.SQUAD_GH_AW_E2E_TARGET_REPOSITORY_ID }}
TARGET_OWNER_ID: ${{ vars.SQUAD_GH_AW_E2E_TARGET_OWNER_ID }}
PAT_ACTOR_LOGIN: ${{ vars.SQUAD_GH_AW_E2E_PAT_ACTOR_LOGIN }}
PAT_ACTOR_ID: ${{ vars.SQUAD_GH_AW_E2E_PAT_ACTOR_ID }}
SOURCE_READ_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
node scripts/gh-aw-hosted-e2e.mjs hosted \
--target "$TARGET_REPOSITORY" \
--target-repository-id "$TARGET_REPOSITORY_ID" \
--target-owner-id "$TARGET_OWNER_ID" \
--pat-actor-login "$PAT_ACTOR_LOGIN" \
--pat-actor-id "$PAT_ACTOR_ID" \
--source-repository "$GITHUB_REPOSITORY" \
--source-repository-id "$GITHUB_REPOSITORY_ID" \
--source-ref "$GITHUB_REF" \
--source-sha "$GITHUB_SHA" \
--evidence "$RUNNER_TEMP/squad-gh-aw-hosted-e2e"
- name: Upload hosted evidence
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 #v7
with:
name: squad-gh-aw-hosted-e2e-${{ github.run_id }}
path: ${{ runner.temp }}/squad-gh-aw-hosted-e2e/
if-no-files-found: error
retention-days: 30