Lab: Manual Workflow
Introduction
In this lab, you will create a manual workflow that can be triggered manually. The workflow will simply echo a message to the console, giving you a hands-on understanding of how manual workflows function in GitHub Actions.
Estimated Duration: 15-20 minutes
Instructions
Step 1: Set up your repository
- Navigate to the repository you created in the previous lab.
- If you haven’t completed the previous lab, clone the template repository by following the instructions in the Create Repository Using Template Repository Lab.
Step 2: Create the manual workflow
- Go to the Actions tab in your repository.
- Click on the New workflow button.
- From the list of workflow templates, select Manual workflow, and then click on Configure.
- This will open the GitHub Actions workflow editor.
Step 3: Add workflow content
-
In the workflow editor:
- Name the workflow file
intro-manual-workflow.yml
. - Paste the following YAML content into the editor:
name: Intro - Manual Workflow on: workflow_dispatch: push: paths: - '.github/workflows/intro-manual-workflow.yml' jobs: run: runs-on: ubuntu-latest steps: - name: How's GitHub Actions? run: echo "Awesome!!"
- Name the workflow file
-
Click the Commit changes button to save the workflow. This will create a new file
.github/workflows/intro-manual-workflow.yml
in your repository.
Step 4: Understand the workflow
- The workflow is named Intro - Manual Workflow.
- It triggers on two events:
workflow_dispatch
: This allows you to run the workflow manually.push
: The workflow will also run when changes are pushed to.github/workflows/intro-manual-workflow.yml
.
- The workflow uses the
ubuntu-latest
runner and contains a single job namedrun
with one step that outputs the message:Awesome!!
.
Step 5: Run the workflow
-
Go back to the Actions tab. You should see the newly created workflow listed there.
- If the workflow is not running, you can manually trigger it.
-
Click on the Run workflow button.
- From the dropdown, select the main branch.
- Click Run workflow to trigger the workflow.
-
Monitor the workflow execution.
- You will see the workflow listed as running in the Actions tab.
Step 6: View the results
- Click on the workflow run to view its details.
- Inside the workflow details page, click on the run job to view the job’s specifics.
- Expand the step titled How’s GitHub Actions? to view the output.
- You should see the message
Awesome!!
displayed as the output of the step.
Summary
In this lab, you created and ran a manual workflow in GitHub Actions. The workflow was triggered manually, ran a single job, and echoed a message to the console. This lab provided insight into how workflows are defined, triggered, and executed.