#!/bin/bash FEATURE_BRANCH= # https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables # skip default branch and tags if [[ $GITHUB_REF =~ ^refs/heads/master$ ]] || [[ $GITHUB_REF =~ ^refs/tags/ ]]; then exit 0; fi # GITHUB_HEAD_REF is set for pull request FEATURE_BRANCH=$([ $GITHUB_HEAD_REF != "" ] && echo $GITHUB_HEAD_REF || echo "$GITHUB_REF" | cut -d"/" -f3) echo "Attempting to install diagram-js@$FEATURE_BRANCH"; npm install "diagram-js@bpmn-io/diagram-js#$FEATURE_BRANCH"; if [ $? -ne 0 ]; then echo "Falling back to diagram-js@develop"; npm install "diagram-js@bpmn-io/diagram-js#develop"; fi