1+ name : Auto-build artifacts on schema update
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - develop
8+ paths :
9+ - ' src/schema/linkml/**'
10+ pull_request :
11+ paths :
12+ - ' src/schema/linkml/**'
13+
14+ jobs :
15+ build-artifacts :
16+ runs-on : ubuntu-latest
17+ if : ${{ !contains(github.event.head_commit.message, '[skip artifacts]') }}
18+
19+ steps :
20+ - name : Checkout repository
21+ uses : actions/checkout@v4
22+ with :
23+ token : ${{ secrets.GITHUB_TOKEN }}
24+ fetch-depth : 0
25+
26+ - name : Set up Python 3.12
27+ uses : actions/setup-python@v4
28+ with :
29+ python-version : 3.12
30+
31+ - name : Install uv
32+ uses : astral-sh/setup-uv@v3
33+
34+ - name : Install dependencies
35+ run : |
36+ uv sync
37+
38+ - name : Generate artifacts
39+ run : |
40+ make gen-artefacts
41+
42+ - name : Check for changes
43+ id : check_changes
44+ run : |
45+ git add src/schema/jsonschema/ src/schema/datamodel/
46+ if git diff --staged --quiet; then
47+ echo "changes=false" >> $GITHUB_OUTPUT
48+ else
49+ echo "changes=true" >> $GITHUB_OUTPUT
50+ fi
51+
52+ - name : Commit and push changes
53+ if : steps.check_changes.outputs.changes == 'true' && github.event_name == 'push'
54+ run : |
55+ git config --local user.email "[email protected] " 56+ git config --local user.name "GitHub Action"
57+ git commit -m "Auto-generate artifacts from schema update [skip artifacts]"
58+ git push
59+
60+ - name : Add PR comment for artifact changes
61+ if : steps.check_changes.outputs.changes == 'true' && github.event_name == 'pull_request'
62+ uses : actions/github-script@v7
63+ with :
64+ script : |
65+ github.rest.issues.createComment({
66+ issue_number: context.issue.number,
67+ owner: context.repo.owner,
68+ repo: context.repo.repo,
69+ body: '🤖 **Artifacts will be auto-generated** when this PR is merged due to schema changes in `src/schema/linkml/`.'
70+ })
0 commit comments