-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (43 loc) · 1.59 KB
/
template-check-version.yml
File metadata and controls
54 lines (43 loc) · 1.59 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
# Adapted from https://github.com/arup-group/actions-city-modelling-lab/blob/main/.github/workflows/template-check.yml
# MIT licensed
name: Reusable workflow for keeping up-to-date with template changes.
on:
workflow_call:
defaults:
run:
shell: bash -l {0}
jobs:
copier-issue:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
env:
UPDATE: false
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Add dummy GitHub credentials
run: |
git config --global user.name Copier update
git config --global user.email check@dummy.bot.com
- name: Run copier update
run: uvx copier update --skip-answered --defaults
- name: Wait a bit for copier cleanups
run: sleep 10s
- name: Display differences
run: git status --porcelain
- name: Set update flag if changes occurred
run: test -z "$(git status --porcelain)" || echo "UPDATE=true" >> $GITHUB_ENV
- name: Show environment variables
run: |
echo "$UPDATE"
- name: Open issue
if: env.UPDATE == true
run: |
gh issue --repo ${{ github.repository }} \
create --title "Template update" \
--body "A new version of the template has been published. Please update this project using \`copier update --skip-answered --defaults\` and review changes. If you need help, refer to the Modelblocks documentation or reach out to the project team."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}