Create test.yaml

This commit is contained in:
nιcнolaѕ wιlde
2024-08-24 01:05:07 -07:00
committed by GitHub
parent 245d087c27
commit aff6575532

32
.github/workflows/test.yaml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Conditional Variable Example
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
set-variable:
runs-on: ubuntu-latest
steps:
- name: Set variable based on event
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "EVENT_TYPE=push" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "pull_request" ]; then
echo "EVENT_TYPE=pull_request" >> $GITHUB_ENV
fi
use-variable:
runs-on: ubuntu-latest
needs: set-variable
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Print event type
run: echo "The event type is $EVENT_TYPE"