-
Notifications
You must be signed in to change notification settings - Fork 3
102 lines (95 loc) · 3.67 KB
/
copier-update.yml
File metadata and controls
102 lines (95 loc) · 3.67 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
name: Copier update repository
on:
schedule:
- cron: "0 2 * * 1" # Every Monday at 2am
workflow_dispatch:
permissions:
contents: write
pull-requests: write
env:
COPIER_OPTIONS: "--trust -A -r main -c 3"
jobs:
update:
name: Update template
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- add-paths: .
body: Use this to merge the changes to this repository.
branch: copier/update
commit-message: "chore(template): accept new copier update"
title: "chore(template): accept new copier update"
# - add-paths: .copier-answers.yml
# body: Use this to reject the changes to this repository.
# branch: copier/reject
# commit-message: "chore(template): reject new copier update"
# title: "chore(template): reject new copier update"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
- uses: ./.github/actions/setup-cached-uv-and-python
with:
python-version-file: ".python-version"
cache-dependency-path: requirements/lock/uvx-tools.txt
- name: Install copier
run:
uv tool install -crequirements/lock/uvx-tools.txt --with
copier-template-extensions copier
- name: Copier update
continue-on-error: false
id: check
run: |
CHANGES=0
if [ -f .copier-answers.yml ]; then
copier update ${{ env.COPIER_OPTIONS }}
if ! git diff --quiet -- .copier-answers.yml; then
CHANGES=1
fi
else
echo "No .copier-answers.yml file"
fi
echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"
- name: Git config
if: steps.check.outputs.has_changes == '1'
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git restore --staged .
- name: Create pull request
if: steps.check.outputs.has_changes == '1'
id: cpr
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.PAT }}
add-paths: ${{ matrix.add-paths }}
commit-message: ${{ matrix.commit-message }}
title: ${{ matrix.title }}
labels: |
internal
template_update
branch: ${{ matrix.branch }}
delete-branch: true
# branch-suffix: timestamp # If want commit per run (instead of per workflow)
body: |
This is an autogenerated PR. ${{ matrix.body }}
[copier](https://github.com/copier-org/copier) has detected updates from the Cookiecutter repository.
- name: Pull request info
if: ${{ steps.cpr.outputs.pull-request-number }}
env:
NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
URL: ${{ steps.cpr.outputs.pull-request-url }}
OPERATION: ${{ steps.cpr.outputs.pull-request-operation }}
SHA: ${{ steps.cpr.outputs.pull-request-sha }}
BRANCH: ${{ steps.cpr.outputs.pull-request-branch }}
VERIFIED: ${{ steps.cpr.outputs.pull-request-commits-verified }}
run: |
echo "Pull Request Number - $NUMBER"
echo "Pull Request URL - $URL"
echo "Pull Request Operation - $OPERATION"
echo "Pull Request SHA - $SHA"
echo "Pull Request BRANCH - $BRANCH"
echo "Pull Request VERIFIED - $VERIFIED"