Skip to content

Commit f1395f4

Browse files
authored
update yml
1 parent 01beb35 commit f1395f4

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

.github/workflows/generate_db.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Generate DBs
22

33
on:
44
schedule:
5-
- cron: '0 12 * * *'
5+
- cron: '0 12 * * *'
66
push:
77
branches:
88
- main
@@ -15,7 +15,8 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v4
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
1920

2021
- name: Set up Python
2122
uses: actions/setup-python@v4
@@ -31,21 +32,45 @@ jobs:
3132
mkdir -p mad
3233
python3 csv2mad.py ArcadeDatabase_CSV/ArcadeDatabase.csv
3334
34-
- name: Commit updated MAD files
35+
- name: Configure Git
3536
run: |
3637
git config --global user.name "The CI/CD Bot"
3738
git config --global user.email "[email protected]"
39+
40+
- name: Create a new branch
41+
run: |
42+
BRANCH_NAME=update-mad-files-${{ github.run_id }}
43+
git checkout -b $BRANCH_NAME
3844
git add mad/
3945
if git diff --cached --quiet; then
4046
echo "No changes to commit"
47+
echo "SKIP_PR=true" >> $GITHUB_ENV
4148
else
4249
git commit -m "Update generated MAD files"
43-
git push
50+
git push origin $BRANCH_NAME
51+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
4452
fi
4553
4654
- name: Generate DBs
55+
if: env.SKIP_PR != 'true'
4756
run: |
48-
set -euo pipefail
49-
git config --global user.email "[email protected]"
50-
git config --global user.name "The CI/CD Bot"
5157
./.github/generate_db.py
58+
59+
- name: Commit generated DB files
60+
if: env.SKIP_PR != 'true'
61+
run: |
62+
git add .
63+
git commit -m "Add generated DB files" || echo "No new DB files to commit"
64+
git push origin $BRANCH_NAME || true
65+
66+
- name: Create Pull Request
67+
if: env.SKIP_PR != 'true'
68+
uses: peter-evans/create-pull-request@v6
69+
with:
70+
token: ${{ secrets.GITHUB_TOKEN }}
71+
commit-message: "Update MAD and DB files"
72+
title: "[Bot] Update MAD and DB files"
73+
body: |
74+
This pull request contains updated MAD files and the generated database files.
75+
branch: ${{ env.BRANCH_NAME }}
76+
base: main

0 commit comments

Comments
 (0)