@@ -90,11 +90,41 @@ jobs:
90
90
91
91
# commit updated project data
92
92
- name : Commit changes
93
- env :
94
- GITHUB_APP_TOKEN : ${{ steps.get_workflow_token.outputs.token }}
95
93
run : |
96
94
git config user.name "the-json-schema-bot[bot]"
97
95
git config user.email "the-json-schema-bot[bot]@users.noreply.github.com"
98
96
git add project_data.json
99
- git diff --quiet && git diff --staged --quiet || (git commit -m "chore(project_data): update project_data.json" && git push "https://x-access-token:${GITHUB_APP_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:${GITHUB_REF#refs/heads/})
97
+ git diff --quiet && git diff --staged --quiet || (git commit -m "chore(project_data): update project_data.json")
98
+
99
+ # create a pull request
100
+ - name : Create Pull Request
101
+ id : cpr
102
+ uses : peter-evans/create-pull-request@v6
103
+ with :
104
+ token : ${{ steps.get_workflow_token.outputs.token }}
105
+ title : ' chore(project_data): update project_data.json'
106
+ body : ' This PR updates the project_data.json file with the latest project data.'
107
+ branch : ' update-project-data'
108
+ base : ' main'
109
+ author : ' the-json-schema-bot <the-json-schema-bot[bot]@users.noreply.github.com>'
110
+ branch-suffix : timestamp
111
+ labels : ' sync-project-data'
112
+ assignees : ' the-json-schema-bot'
113
+ draft : false
114
+ signoff : true
115
+ add-paths : ' project_data.json'
100
116
117
+ # Approving with github bot token because one cannot approve their own PRs
118
+ - name : Auto Approve
119
+ if : steps.cpr.outputs.pull-request-operation == 'created'
120
+ run : gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}"
121
+ env :
122
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
123
+
124
+ - name : Auto Merge PR
125
+ if : steps.cpr.outputs.pull-request-operation == 'created'
126
+ uses : peter-evans/enable-pull-request-automerge@v3
127
+ with :
128
+ pull-request-number : ${{ steps.cpr.outputs.pull-request-number }}
129
+ merge-method : ' squash'
130
+ token : ${{ steps.get_workflow_token.outputs.token }}
0 commit comments