-
-
Notifications
You must be signed in to change notification settings - Fork 6
71 lines (61 loc) · 2.37 KB
/
trigger-template-update.yml
File metadata and controls
71 lines (61 loc) · 2.37 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
name: Update Child Repository Template
on:
release:
types: [published, released]
push:
tags:
- "v*"
workflow_dispatch:
inputs:
target_repository:
description: "Target repository to update (default: mjun0812/python-project-template)"
required: false
default: "mjun0812/python-project-template"
jobs:
update-child-template:
runs-on: ubuntu-latest
steps:
- name: Checkout child repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.target_repository || 'mjun0812/python-project-template' }}
token: ${{ secrets.CHILD_REPO_TOKEN }}
path: child-repo
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Update template in child repository
working-directory: child-repo
run: |
# Update from template
uvx copier update -A --trust
- name: Check for changes
id: changes
working-directory: child-repo
run: |
if git diff --quiet; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.CHILD_REPO_TOKEN }}
path: child-repo
commit-message: |
Update template to version ${{ github.event.release.tag_name || 'latest' }}
title: "Update template to version ${{ github.event.release.tag_name || 'latest' }}"
body: |
## Template Update
This PR updates the project template to version `${{ github.event.release.tag_name || 'latest' }}`.
### Changes
- Updated from template: ${{ github.repository }}
- Template version: ${{ github.event.release.tag_name || 'latest' }}
${{ github.event.release.html_url && format('- Release notes: {0}', github.event.release.html_url) || '' }}
### Testing
Please review the changes and test the updated template before merging.
---
*This PR was automatically created by the template update workflow.*
branch: template-update-${{ github.event.release.tag_name || github.run_number }}
delete-branch: true