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