xref: /template/strap/.github/bootstrap.sh (revision 977ce05d19d8dab0a70c9a27f8da0b7039299e82)
1*977ce05dSgerardnico#!/bin/bash
2*977ce05dSgerardnico# https://docs.github.com/en/actions/learn-github-actions/contexts#example-usage-of-the-github-context
3*977ce05dSgerardnico# https://docs.github.com/en/actions/learn-github-actions/variables#using-the-vars-context-to-access-configuration-variable-values
4*977ce05dSgerardnico# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
5*977ce05dSgerardnicoif [ "${GITHUB_EVENT_NAME}" == 'pull_request' ];
6*977ce05dSgerardnicothen
7*977ce05dSgerardnico    # The head ref or source branch of the pull request in a workflow run.
8*977ce05dSgerardnico    # This property is only set when the event that triggers a workflow run is either pull_request or pull_request_target.
9*977ce05dSgerardnico    # For example, feature-branch-1
10*977ce05dSgerardnico    BUILD_SOURCE_BRANCH=${GITHUB_HEAD_REF};
11*977ce05dSgerardnico    # The name of the base ref or target branch of the pull request in a workflow run.
12*977ce05dSgerardnico    # This is only set when the event that triggers a workflow run is either pull_request or pull_request_target.
13*977ce05dSgerardnico    # For example, main
14*977ce05dSgerardnico    BUILD_TARGET_BRANCH=${GITHUB_BASE_REF};
15*977ce05dSgerardnico    echo -e "\nPull request from the branch (${BUILD_SOURCE_BRANCH}) to the branch (${BUILD_TARGET_BRANCH})";
16*977ce05dSgerardnicofi;
17*977ce05dSgerardnico# The short ref name of the branch or tag that triggered the workflow run.
18*977ce05dSgerardnico# This value matches the branch or tag name shown on GitHub.
19*977ce05dSgerardnico# For example, feature-branch-1
20*977ce05dSgerardnicoBUILD_BRANCH=${GITHUB_REF_NAME};
21*977ce05dSgerardnicoecho -e "\nGet boot.sh from from the branch (${BUILD_BRANCH})";
22*977ce05dSgerardnicocurl -H "Authorization: token ${TOKEN}" -o "boot.sh" "https://raw.githubusercontent.com/ComboStrap/combo_test/${BUILD_BRANCH}/resources/script/ci/boot.sh"
23*977ce05dSgerardnicoecho -e "\nRun boot.sh";
24*977ce05dSgerardnicochmod +x boot.sh
25*977ce05dSgerardnicosource boot.sh
26