mirror of
https://github.com/nicholaswilde/recipes.git
synced 2026-02-04 19:45:25 +00:00
Create test.yaml
This commit is contained in:
32
.github/workflows/test.yaml
vendored
Normal file
32
.github/workflows/test.yaml
vendored
Normal 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"
|
||||
Reference in New Issue
Block a user