AAE-11221 - TRAVIS_EVENT_TYPE parse action

This commit is contained in:
Marco Carrozzo 2022-10-28 12:59:11 +02:00 committed by GitHub
parent c3bc1b4eff
commit bc57305e1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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