Skip to content

Commit ad7697d

Browse files
authored
chore(ci): Automatic update from template (#40)
2 parents b65c345 + 98ba1ea commit ad7697d

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/template.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Template Update
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
schedule:
8+
- cron: '1 1 1 * *'
9+
workflow_dispatch:
10+
11+
env:
12+
RUST_BACKTRACE: 1
13+
CARGO_TERM_COLOR: always
14+
CLICOLOR: 1
15+
TEMPLATE_URL: "https://github.com/epage/_rust.git"
16+
TEMPLATE_BRANCH: "main"
17+
18+
concurrency:
19+
group: "${{ github.workflow }}-${{ github.ref }}"
20+
cancel-in-progress: true
21+
22+
jobs:
23+
update:
24+
permissions:
25+
security-events: write # to create PR
26+
pull-requests: write
27+
contents: write # to push the branch
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
- name: Configure git
35+
run: |
36+
git config --global user.name '${{ github.actor }}'
37+
git config --global user.email '<>'
38+
- name: Fetch template
39+
run: "git remote add template ${{ env.TEMPLATE_URL }} && git fetch template ${{ env.TEMPLATE_BRANCH }}"
40+
- name: Merge template
41+
run: "git checkout -b template-update && git merge template/${{ env.TEMPLATE_BRANCH }} -m 'chore: Update from template'"
42+
- name: Push branch
43+
run: "git push --set-upstream origin template-update"
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
- name: Create PR
47+
run: "gh pr create --head template-update --title 'chore: Update from template' --body ''"
48+
env:
49+
GH_TOKEN: ${{ github.token }}
50+
- name: Merge PR
51+
run: "gh pr merge --auto --delete-branch"
52+
env:
53+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)