Skip to content

Instantly share code, notes, and snippets.

@datYori
Last active December 19, 2022 09:00
Show Gist options
  • Save datYori/2d040ca693d8bb994ae1704c699c9af5 to your computer and use it in GitHub Desktop.
Save datYori/2d040ca693d8bb994ae1704c699c9af5 to your computer and use it in GitHub Desktop.
switch default and run
export INITIAL_DEFAULT_BRANCH=${INITIAL_DEFAULT_BRANCH:-master}
export WORKFLOW_YAML=<workflow_yaml>
export ORG_REPO=<repo> # example : export REPO="raw-labs/raw"
gh api -XPATCH "${ORG_REPO}" -f default_branch="$(git symbolic-ref --short HEAD)" > dev/null \
&& gh workflow run ${WORKFLOW_YAML} \
&& gh api -XPATCH "${ORG_REPO}" -f default_branch="${INITIAL_DEFAULT_BRANCH}" > dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment