@@ -447,7 +447,7 @@ jobs:
447
447
448
448
- name : " Upload artifacts: scripts/res/apiDocs"
449
449
id : upload-api-docs
450
- if : ${{ matrix.generate_api_docs && startsWith(github.ref, 'refs/tags/v') }}
450
+ if : ${{ matrix.generate_api_docs }}
451
451
uses : actions/upload-artifact@v4
452
452
with :
453
453
name : api-docs
@@ -492,39 +492,37 @@ jobs:
492
492
repository : rescript-lang/rescript-lang.org
493
493
token : ${{ secrets.GITHUB_TOKEN }}
494
494
495
- - name : Set up Git config
496
- run : |
497
- git config --global user.name "github-actions[bot]"
498
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
499
-
500
- - name : Authenticate GitHub CLI
501
- env :
502
- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
503
- run : echo "$GH_TOKEN" | gh auth login --with-token
504
-
505
- - name : create-new-branch
506
- run : git checkout -b sync-api-docs-${{ github.ref_name }}
507
-
508
495
- name : Download artifacts
509
496
uses : actions/download-artifact@v4
510
497
with :
511
498
artifact-ids : ${{ needs.build-compiler.outputs.api-docs-artifact-id }}
512
499
path : data/api
513
500
501
+ - name : Check if repo is clean
502
+ id : diffcheck
503
+ run : |
504
+ if [ -z "$(git status --porcelain)" ]; then
505
+ echo "clean=true" >> $GITHUB_OUTPUT
506
+ else
507
+ echo "clean=false" >> $GITHUB_OUTPUT
508
+ fi
509
+
510
+ - name : Build website
511
+ if : steps.diffcheck.outputs.clean == 'false'
512
+ run : |
513
+ npm ci
514
+ npx rescript
515
+ npm run build
516
+
514
517
- name : Commit and push
518
+ if : ${{ startsWith(github.ref, 'refs/tags/v') }}
515
519
run : |
520
+ echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
521
+ git config --global user.name "github-actions[bot]"
522
+ git config --global user.email "[email protected] "
516
523
git add data/api
517
524
git commit -m "Update API docs for ${{ github.ref_name }}"
518
- git push --set-upstream origin sync-api-docs-${{ github.ref_name }}
519
-
520
- - name : Create Pull Request
521
- run : |
522
- cd repo-b
523
- gh pr create \
524
- --title "Sync API docs for ${{ github.ref_name }}" \
525
- --body "Sync API docs for ${{ github.ref_name }}. This PR was created via GitHub Actions using gh CLI." \
526
- --head sync-api-docs-${{ github.ref_name }} \
527
- --base master
525
+ git push
528
526
529
527
test-integration :
530
528
needs :
0 commit comments