diff --git a/.github/actions/travis-event-type-load/action.yml b/.github/actions/travis-event-type-load/action.yml new file mode 100644 index 0000000000..176f78cec2 --- /dev/null +++ b/.github/actions/travis-event-type-load/action.yml @@ -0,0 +1,28 @@ +# TRAVIS_EVENT_TYPE= Indicates how the build was triggered. One of push, pull_request, api, cron +name: "travis-event-type-env-var" +description: "Mimic loading of a TRAVIS_EVENT_TYPE env var" + +inputs: + event_name: + description: "override github.event_name" + required: false + default: ${{ github.event_name }} +runs: + using: "composite" + steps: + - name: Parse env global + run: | + EVENT_TYPE="" + REGEX="(repository|workflow)_dispatch" + if [[ "${{ inputs.event_name }}" == "schedule" ]]; then + EVENT_TYPE="cron"; + elif [[ "${{ inputs.event_name }}" == "pull_request" ]]; then + EVENT_TYPE="pull_request"; + elif [[ "${{ inputs.event_name }}" == "push" ]]; then + EVENT_TYPE="push"; + elif [[ "${{ inputs.event_name }}" =~ $REGEX ]]; then + EVENT_TYPE="api"; + fi + echo "TRAVIS_EVENT_TYPE=${EVENT_TYPE}" >> $GITHUB_ENV + echo "exporting TRAVIS_EVENT_TYPE=${EVENT_TYPE}" + shell: bash