From dc5b68813ddbf79bb730c35c73d1127a476c29ce Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Tue, 24 Nov 2020 01:14:37 -0700 Subject: [PATCH] Use complete-build to skip README deploy if not on master --- .builds/readme.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.builds/readme.yml b/.builds/readme.yml index ffc624f..8bddd17 100644 --- a/.builds/readme.yml +++ b/.builds/readme.yml @@ -16,20 +16,23 @@ triggers: condition: failure to: ~sumner/sublime-music-devel@lists.sr.ht tasks: + # Skip everything if not on master. + - skip_not_master: | + cd $REPO_NAME + git branch --contains | grep master || echo "Skipping README deploy since not on master" + git branch --contains | grep master || complete-build + - setup: | pip3 install rst2html5 echo "cd ${REPO_NAME}" >> ~/.buildenv echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.buildenv - # If we are on the master branch, compile the README.rst to HTML and set it - # as the README for the repo. - readme: | set +x - git branch --contains | grep master && - rst2html5 --template="{body}" README.rst | \ - curl -H "Content-Type: text/html" \ - -H "Authorization: Bearer $(cat ~/.readme-token)" \ - -XPUT \ - --data-binary @- \ - "https://git.sr.ht/api/repos/${REPO_NAME}/readme" && - echo "README set" || echo "Skipping README set because not on master" + set -e + rst2html5 --template="{body}" README.rst | \ + curl -H "Content-Type: text/html" \ + -H "Authorization: Bearer $(cat ~/.readme-token)" \ + -XPUT \ + --data-binary @- \ + "https://git.sr.ht/api/repos/${REPO_NAME}/readme"