-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (36 loc) · 1.04 KB
/
01-firstworkflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: 01-first workflow
on:
push:
branches-ignore:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
branch:
description: 'Branch to test'
type: string
default: 'dev'
jobs:
echo-hello:
runs-on: ubuntu-latest
steps:
- name: Trigger
run: echo "Triggered by ${{github.event_name}} event"
- name: Check Branch Input
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
if [ -z "${{ github.event.inputs.branch }}" ]; then
echo "Branch input is required for manual trigger."
exit 1
fi
fi
- name: Checkout
uses: actions/[email protected]
with:
ref: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref }}"
- name: Log Current Branch and Commit
run: |
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Current commit: $(git rev-parse HEAD)"