Skip to content

Commit ffb2f07

Browse files
committed
feat: improve updating branches
1 parent d5069be commit ffb2f07

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

.github/workflows/update-generated.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
23+
if: github.event_name != 'pull_request'
24+
with:
25+
token: ${{ secrets.WEBLATE_CI_TOKEN }}
26+
submodules: true
27+
persist-credentials: true
28+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
29+
if: github.event_name == 'pull_request'
2330
with:
2431
submodules: true
2532
persist-credentials: false
@@ -30,9 +37,6 @@ jobs:
3037
with:
3138
python-version: '3.13'
3239
- uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
33-
with:
34-
enable-cache: true
35-
cache-dependency-glob: ''
3640
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
3741
with:
3842
path: ~/.cache/pre-commit
@@ -54,10 +58,17 @@ jobs:
5458
commit_message: 'chore: update generated files'
5559

5660
- name: Create Pull Request
57-
if: github.ref == 'refs/heads/main'
61+
id: cpr
62+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.ref_name == 'main'
5863
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
5964
with:
6065
branch: create-pull-request/submodule-update
6166
title: 'chore: update generated files'
6267
commit-message: 'chore: update generated files'
6368
token: ${{ secrets.WEBLATE_CI_TOKEN }}
69+
- name: Enable Pull Request Automerge
70+
if: steps.cpr.outputs.pull-request-operation && steps.cpr.outputs.pull-request-operation != 'none'
71+
run: gh pr merge --rebase --auto "$PR_NUMBER"
72+
env:
73+
GH_TOKEN: ${{ secrets.WEBLATE_CI_TOKEN }}
74+
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}

0 commit comments

Comments
 (0)