tf-a-lts-docs-watcher.sh: Factor out RTD_API definition
Define based on the project name.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I71bcfdfa3ccf8860164930a3a33b073b3098e7e1
diff --git a/scripts/tf-a-lts-docs-watcher.sh b/scripts/tf-a-lts-docs-watcher.sh
index c56ebf5..e3850ef 100755
--- a/scripts/tf-a-lts-docs-watcher.sh
+++ b/scripts/tf-a-lts-docs-watcher.sh
@@ -10,20 +10,20 @@
# For real production project, non-sandbox run goes to production RTD project,
# while for sandbox run to a separate RTD project.
if [ "${SANDBOX_RUN}" == "false" ]; then
+ RTD_PROJECT="trustedfirmware-a"
RTD_WEBHOOK_URL="https://readthedocs.org/api/v2/webhook/trustedfirmware-a/87181/"
- RTD_API="https://readthedocs.org/api/v3/projects/trustedfirmware-a"
RTD_WEBHOOK_SECRET_KEY=${RTD_WEBHOOK_SECRET}
RTD_API_TOKEN=${RTD_API_TOKEN}
else
+ RTD_PROJECT="trustedfirmware-a-sandbox"
RTD_WEBHOOK_URL="https://readthedocs.org/api/v2/webhook/trustedfirmware-a-sandbox/263958/"
- RTD_API="https://readthedocs.org/api/v3/projects/trustedfirmware-a-sandbox"
RTD_WEBHOOK_SECRET_KEY=${TFA_SANDBOX_RTD_WEBHOOK_SECRET}
RTD_API_TOKEN=${PFALCON_RTD_API_TOKEN}
fi
elif [ "${GERRIT_PROJECT}" == "sandbox/pfalcon/trusted-firmware-a" ]; then
# For test project, both "production" and "sandbox" go to the same elsewhere project.
+ RTD_PROJECT="pfalcon-trustedfirmware-a-sandbox"
RTD_WEBHOOK_URL="https://readthedocs.org/api/v2/webhook/pfalcon-trustedfirmware-a-sandbox/263459/"
- RTD_API="https://readthedocs.org/api/v3/projects/pfalcon-trustedfirmware-a-sandbox"
RTD_WEBHOOK_SECRET_KEY=${PFALCON_RTD_WEBHOOK_SECRET}
RTD_API_TOKEN=${PFALCON_RTD_API_TOKEN}
else
@@ -31,6 +31,7 @@
exit 1
fi
+RTD_API="https://readthedocs.org/api/v3/projects/${RTD_PROJECT}"
RTD_VER_API="${RTD_API}/versions"
new_tag=""