Skip to content

Commit 1a87a02

Browse files
authored
Add workflow for automated test-suite update (#106)
1 parent 2d7614a commit 1a87a02

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Checks JSON schema test suite for updates
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 12 * * *'
7+
8+
jobs:
9+
check-updates:
10+
runs-on: ubuntu-latest
11+
env:
12+
SUITE_PATH: test-suites/schema-test-suite
13+
steps:
14+
- name: 'Checkout Repository'
15+
uses: actions/checkout@v4
16+
with:
17+
token: ${{ secrets.PUSH_PAT }}
18+
submodules: true
19+
- name: Pull latest changes from JSON schema test suite
20+
run: git submodule update --remote
21+
- name: Check for updates
22+
id: updates
23+
run: |
24+
DIFF=$(git diff)
25+
HAS_UPDATES=false
26+
if [[ "$DIFF" != "" ]]; then
27+
HAS_UPDATES=true
28+
else
29+
echo "No updates"
30+
fi
31+
echo "has-updates=$HAS_UPDATES" >> $GITHUB_OUTPUT
32+
cd ${SUITE_PATH}
33+
SUITE_SHA=$(git rev-parse --short HEAD)
34+
echo "branch=suite-${SUITE_SHA}"
35+
- name: Commit changes to new branch
36+
if: steps.updates.outputs.has-updates == 'true'
37+
uses: EndBug/add-and-commit@v9
38+
with:
39+
add: "['${{ env.SUITE_PATH }}']"
40+
default_author: github_actions
41+
message: "Update JSON schema test-suite"
42+
new_branch: ${{ steps.updates.outputs.branch }}
43+
- name: Create PR for version update
44+
if: steps.updates.outputs.has-updates == 'true'
45+
env:
46+
GH_TOKEN: ${{ secrets.PUSH_PAT }}
47+
run: >
48+
gh pr create --title "Update JSON schema test-suite"
49+
--body "Automated update"
50+
--head ${{ steps.updates.outputs.branch }}
51+
--base main
52+
--reviewer OptimumCode
53+
--label ignore
54+
--label tests
55+

0 commit comments

Comments
 (0)