Skip to content

Commit 398e0d9

Browse files
Open a PR if SQLX files need an update
1 parent 192dadc commit 398e0d9

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

.github/workflows/commit-sqlx-changes.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ env:
1919

2020
permissions:
2121
contents: write
22+
pull-requests: write
2223

2324
jobs:
2425
commit-sqlx-changes:
2526
if: ${{ github.event.pull_request.merged }}
2627
runs-on: ubuntu-latest
28+
outputs:
29+
output1: $
2730
steps:
2831
- uses: actions/checkout@v4
2932

@@ -56,12 +59,30 @@ jobs:
5659
just sqlx-prepare
5760
# If there are differences in the SQLX files, then we push them on the master branch
5861
if git status --porcelain .sqlx ; then
59-
git config --global user.name 'Docs.rs developers'
60-
git config --global user.email '[email protected]'
61-
git add .sqlx
62-
git commit -m 'Update SQLX files'
63-
git push
62+
echo "need_pr" >> "$GITHUB_OUTPUT"
6463
fi
6564
6665
- name: Clean up the database
6766
run: docker compose down --volumes
67+
68+
create-pull-request:
69+
if: ${{ github.event.pull_request.merged }}
70+
needs: commit-sqlx-changes
71+
runs-on: ubuntu-latest
72+
steps:
73+
- env:
74+
OUTPUT1: $
75+
- name: Open pull request
76+
if: ${{ OUTPUT1 == 'need_or' }}
77+
uses: peter-evans/create-pull-request@v7
78+
with:
79+
commit-message: Update SQLX files
80+
committer: Docs.rs developers <[email protected]>
81+
author: Docs.rs developers <[email protected]>
82+
signoff: false
83+
title: Update SQLX files
84+
delete-branch: true
85+
branch: update-sqlx-pr-${{ github.event.pull_request.number }}
86+
title: Update SQLX files after #${{ github.event.pull_request.number }} changes
87+
body: |
88+
Following #${{ github.event.pull_request.number }} changes, here are the related SQLX files changes.

0 commit comments

Comments
 (0)