Skip to content

Commit

Permalink
ci: Add an automated update job
Browse files Browse the repository at this point in the history
See for a live example bilelmoussaoui/gtk4-rs#2
  • Loading branch information
bilelmoussaoui committed Feb 10, 2025
1 parent 9bf4186 commit 83d3161
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/auto-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Auto updates

on:
repository_dispatch:
types: [internal-merge-event]

jobs:
regen:
runs-on: ubuntu-latest

steps:
- name: Checkout current repository
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git submodule update --checkout
- name: Update Git submodules
run: |
cd ./gir && git fetch --all && git reset --hard origin/main && cd ../
git add .
git diff --cached --exit-code || git commit -m "Update gir"
python generator.py
git add .
git diff --cached --exit-code || git commit -m "Regenerate with latest gir"
cd ./gir-files && git fetch --all && git reset --hard origin/main && cd ../
git add .
git diff --cached --exit-code || git commit -m "Update gir-files"
python generator.py
git add .
git diff --cached --exit-code || git commit -m "Regenerate with latest gir-files"
- name: Push changes
run: |
git push origin "auto-pr-branch" || echo "Branch already exists"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: "auto-pr-branch"
title: "Automated PR: Changes from updating gir/gir-files"
body: "This PR contains auto-generated changes after a merge in the external gir-files repository."
commit-message: "Auto-generated changes from updating gir/gir-files"
author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"

0 comments on commit 83d3161

Please sign in to comment.