diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index f887f96752..236f2ef5dd 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -34,8 +34,17 @@ jobs: cat docs/dfx-json-schema.json echo "networks.json schema:" cat docs/networks-json-schema.json - git config user.name "GitHub Actions Bot" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add docs/dfx-json-schema.json docs/networks-json-schema.json - git commit -m "update dfx-json-schema and networks-json-schema" || true - git push \ No newline at end of file + if [[ $(git status | wc -l) -eq 2 ]]; then + if [[ ${{ github.event.pull_request.head.repo.full_name == github.repository }} ]]; then + git config user.name "GitHub Actions Bot" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add docs/dfx-json-schema.json docs/networks-json-schema.json + git commit -m "update dfx-json-schema and networks-json-schema" || true + git push + else + echo "Schemas are not up to date. Please run the following:" + echo " dfx schema --outfile docs/dfx-json-schema.json" + echo " dfx schema --for networks --outfile docs/networks-json-schema.json" + exit 1 + fi + fi \ No newline at end of file