Update 01-firstworkflow.yaml #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)" |