One way I could see this being implemented is by adding a branch option to a task. The syntax might look something like this:
tasks:
- deploy:
branch: master
run: |
rsync ...
A current workaround would be:
tasks:
- deploy: |
cd repo_name
# We only want to deploy when on master. We cain't just check if
# --abbrev-ref is master since the HEAD is detached.
if [ "$(git rev-parse master)" = "$(git rev-parse HEAD)" ]; then
rsync ...
else
echo "Not on master, skipping..."
fi
+1 Would love to have this as an option. Related: https://todo.sr.ht/%7Esircmpwn/dispatch.sr.ht/15
Workaround: the special
complete-build
command can be used to end a build early (without failing it).
+1 for me as well. But combining your suggestions works, so no hurry.
tasks:
- check-branch: | cd repo_name if [ "$(git rev-parse master)" != "$(git rev-parse HEAD)" ]; then
complete-build;
fi
Eh.. it says 'Markdown supported loud and clear. Still forgot it.
tasks: - check-branch: | cd repo_name if [ "$(git rev-parse master)" != "$(git rev-parse HEAD)" ]; then \ complete-build; \ fi