-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
97 lines (87 loc) · 3.04 KB
/
Copy pathaction.yml
File metadata and controls
97 lines (87 loc) · 3.04 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
name: Copier Update
description: 'Update copier-templated repo from upstream'
inputs:
token:
type: string
description: "GitHub Token"
required: true
base:
type: string
description: "Branch to update (default: main)"
required: false
default: "main"
branch:
type: string
description: "Branch to update (default: copier-update)"
required: false
default: "copier-update"
title:
type: string
description: "Pull request title (default: 'Update from copier')"
required: false
default: "Update from copier"
runs:
using: 'composite'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
token: ${{ inputs.token }}
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: '3.11'
- run: pip install copier
shell: bash
- run: copier update -A -f -a .copier-answers*
shell: bash
- run: |
if git status --porcelain -- ':!.copier-answers.yaml' ':!pnpm-lock.yaml' ':!js/pnpm-lock.yaml' ':!Cargo.lock' ':!rust/Cargo.lock' | grep -q .; then
echo "COPIER_CHANGED=true" >> "$GITHUB_ENV"
fi
shell: bash
- if: env.COPIER_CHANGED == 'true' && hashFiles('pnpm-lock.yaml') != ''
uses: pnpm/action-setup@v4
with:
version: 9
continue-on-error: true
- if: env.COPIER_CHANGED == 'true' && hashFiles('pnpm-lock.yaml') != ''
run: pnpm install --no-frozen-lockfile
shell: bash
continue-on-error: true
- if: env.COPIER_CHANGED == 'true' && hashFiles('js/pnpm-lock.yaml') != ''
uses: pnpm/action-setup@v4
with:
version: 9
package_json_file: js/package.json
continue-on-error: true
- if: env.COPIER_CHANGED == 'true' && hashFiles('js/pnpm-lock.yaml') != ''
run: cd js && pnpm install --no-frozen-lockfile
shell: bash
continue-on-error: true
- if: env.COPIER_CHANGED == 'true' && hashFiles('Cargo.lock', 'rust/Cargo.lock') != ''
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
continue-on-error: true
- if: env.COPIER_CHANGED == 'true' && hashFiles('Cargo.lock') != ''
run: cargo update
shell: bash
continue-on-error: true
- if: env.COPIER_CHANGED == 'true' && hashFiles('rust/Cargo.lock') != ''
run: cd rust && cargo update
shell: bash
continue-on-error: true
- if: env.COPIER_CHANGED == 'true'
run: |
CURRENT_DATE=`date -u +"%Y-%m-%dT%H-%M-%S"`
MESSAGE="${{ inputs.title }} (`date -u +"%Y-%m-%dT%H:%M:%S"`)"
BRANCH=${{ inputs.branch }}-$CURRENT_DATE
git config --global user.name "github-actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b $BRANCH
git add .
git commit -m "$MESSAGE" -s
git push origin $BRANCH
gh pr create -B ${{ inputs.base }} -H $BRANCH --title "$MESSAGE" --body ""
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}