This repository was archived by the owner on Dec 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
105 lines (85 loc) · 3.23 KB
/
action.yml
File metadata and controls
105 lines (85 loc) · 3.23 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
102
103
104
105
name: Sync Repository Template
description: Synchronize a repository template into the current project and optionally open a pull request
author: Thomas Schmelzer
inputs:
token:
description: GitHub token or PAT for authentication
required: true
branch:
description: Target branch for the sync
required: false
default: sync/template-update
commit-message:
description: Commit message for the sync
required: false
default: "chore: sync template"
create-pr:
description: Whether to create a pull request if changes are detected
required: false
default: "true"
outputs:
changes-detected:
description: Whether changes were detected during the sync (true or false)
value: ${{ steps.sync.outputs.changes_detected }}
runs:
using: composite
steps:
# ------------------------------------------------------------
# Checkout target repository
# ------------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ inputs.token }}
fetch-depth: 0
# ------------------------------------------------------------
# Tooling
# ------------------------------------------------------------
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.17"
# ------------------------------------------------------------
# Validate configuration
# ------------------------------------------------------------
- name: Validate rhiza configuration
shell: bash
run: uvx rhiza validate .
# ------------------------------------------------------------
# Materialize + commit changes
# ------------------------------------------------------------
- name: Sync template
id: sync
shell: bash
run: |
set -euo pipefail
git checkout -B "${{ inputs.branch }}"
uvx rhiza materialize .
git add -A
if git diff --cached --quiet; then
echo "No changes detected."
echo "changes_detected=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "changes_detected=true" >> "$GITHUB_OUTPUT"
if git diff --cached --name-only | grep -q '^\.github/workflows/'; then
echo "⚠️ Workflow files modified — PAT with workflow scope may be required."
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "${{ inputs.commit-message }}"
git push origin "HEAD:${{ inputs.branch }}" --force-with-lease
# ------------------------------------------------------------
# Create Pull Request
# ------------------------------------------------------------
- name: Create pull request
if: ${{ inputs.create-pr == 'true' && steps.sync.outputs.changes_detected == 'true' }}
uses: peter-evans/create-pull-request@v8
with:
token: ${{ inputs.token }}
branch: ${{ inputs.branch }}
delete-branch: false
title: ${{ inputs.commit-message }}
body: |
This pull request synchronizes the repository with its template.
Changes were generated automatically using **rhiza**.