-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.25 KB
/
nightly-stack-sync.yml
File metadata and controls
76 lines (65 loc) · 2.25 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
name: Nightly stack sync
on:
schedule:
# Run every night at 02:00 UTC
- cron: '0 2 * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
sync:
name: Regenerate stacks and open PR if drifted
runs-on: ubuntu-latest
steps:
- name: Checkout dev branch
uses: actions/checkout@v6
with:
ref: dev
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install Python deps
run: pip install -r tools/requirements.txt
- name: Install yq
run: |
YQ_VERSION="v4.44.3"
sudo wget -qO /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64"
sudo chmod +x /usr/local/bin/yq
yq --version
- name: Validate YAML with yq
run: |
set -euo pipefail
while IFS= read -r file; do
yq e '.' "$file" >/dev/null
done < <(find .github/workflows stacks -type f \( -name '*.yml' -o -name '*.yaml' \) | sort)
- name: Regenerate stacks
run: python3 tools/generate_stacks.py
- name: Check for drift
id: drift
run: |
if git diff --quiet stacks/; then
echo "drifted=false" >> "$GITHUB_OUTPUT"
else
echo "drifted=true" >> "$GITHUB_OUTPUT"
git diff --stat stacks/
fi
- name: Open or update PR for drifted stacks
if: steps.drift.outputs.drifted == 'true'
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
signoff: true
delete-branch: true
commit-message: "chore(stacks): nightly regeneration from compose sources"
author: "Author <actions@github.com>"
title: "chore(stacks): nightly stack regeneration"
body: |
Automated PR: stacks/ drifted from compose sources. Generated by the nightly-stack-sync workflow.
Run `./stackctl.sh sync` locally to reproduce the diff.
branch: chore/nightly-stack-sync
labels: ":skateboard: skip-changelog"
assignees: "wax911"
reviewers: "wax911"