From 86bd01b2fca249df50e4d07518cea23c41f5cf47 Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Fri, 26 Aug 2022 11:06:58 +0200 Subject: [PATCH] chore: fix forked PR docs workflow --- .github/workflows/update-docs.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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