Skip to content

Commit efff721

Browse files
ci: Add an automated update job
See bilelmoussaoui#2
1 parent aa5ff9d commit efff721

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/auto-update.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Auto updates
2+
3+
on:
4+
repository_dispatch:
5+
types: [internal-merge-event]
6+
7+
jobs:
8+
regen:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout current repository
13+
uses: actions/checkout@v4
14+
with:
15+
submodules: true
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.x'
21+
22+
- name: Configure Git
23+
run: |
24+
git config user.name "github-actions[bot]"
25+
git config user.email "github-actions[bot]@users.noreply.github.com"
26+
git submodule update --checkout
27+
28+
- name: Update Git submodules
29+
run: |
30+
cd ./gir && git fetch --all && git reset --hard origin/main && cd ../
31+
git add .
32+
git diff --cached --exit-code || git commit -m "Update gir"
33+
python generator.py
34+
git add .
35+
git diff --cached --exit-code || git commit -m "Regenerate with latest gir"
36+
cd ./gir-files && git fetch --all && git reset --hard origin/main && cd ../
37+
git add .
38+
git diff --cached --exit-code || git commit -m "Update gir-files"
39+
python generator.py
40+
git add .
41+
git diff --cached --exit-code || git commit -m "Regenerate with latest gir-files"
42+
43+
- name: Push changes
44+
run: |
45+
git push origin "auto-pr-branch" || echo "Branch already exists"
46+
47+
- name: Create Pull Request
48+
uses: peter-evans/create-pull-request@v5
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
branch: "auto-pr-branch"
52+
title: "Automated PR: Changes from updating gir/gir-files"
53+
body: "This PR contains auto-generated changes after a merge in the external gir-files repository."
54+
commit-message: "Auto-generated changes from updating gir/gir-files"
55+
author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"

0 commit comments

Comments
 (0)