44 push :
55 branches :
66 - main
7+ workflow_dispatch :
78
89permissions : write-all
910
@@ -12,45 +13,37 @@ jobs:
1213 runs-on : ubuntu-latest
1314
1415 steps :
15- - name : Checkout code
16- uses : actions/checkout@v6
16+ - uses : actions/checkout@v6
1717
18- - name : Setup PHP
19- uses : shivammathur/setup-php@v2
18+ - uses : shivammathur/setup-php@v2
2019 with :
2120 php-version : ' 8.4'
2221 extensions : curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json
2322 coverage : none
2423
25- - name : Git setup
26- if : success()
27- run : |
28- git config --local user.email "action@github.com"
29- git config --local user.name "GitHub Action"
30-
31- - name : Install dependencies
24+ - name : Install Composer dependencies
3225 run : composer update --prefer-stable --prefer-dist --no-progress --no-interaction
3326
3427 - name : Update data
3528 id : data
36- if : success()
37- run : |
38- IS_DIRTY=1
39-
40- composer collect
41-
42- { git add . && git commit -a -m "📦 Data updated"; } || IS_DIRTY=0
43-
44- echo "is_dirty=${IS_DIRTY}" >> "$GITHUB_OUTPUT"
45-
46- - name : Fix the code style
47- uses : TheDragonCode/codestyler@v5
48- with :
49- github_token : ${{ secrets.COMPOSER_TOKEN }}
50- fix : true
29+ run : composer collect
5130
52- - name : Push changes
53- uses : ad-m/github-push-action@master
54- if : success() && steps.data.outputs.is_dirty == 1
31+ - name : Create a Pull Request
32+ uses : peter-evans/create-pull-request@v8
33+ id : pullRequest
5534 with :
56- github_token : ${{ secrets.COMPOSER_TOKEN }}
35+ branch : projects/download
36+ branch-suffix : random
37+ delete-branch : true
38+ add-paths : ./data
39+ title : " [source]: Data updated"
40+ commit-message : 📦 Data updated
41+ body : 📦 Data updated
42+ labels : |
43+ source
44+
45+ - name : Merge PR
46+ if : ${{ steps.pullRequest.outputs.pull-request-number }}
47+ env :
48+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
49+ run : gh pr merge --merge --auto ${{ steps.pullRequest.outputs.pull-request-number }}
0 commit comments