In this lab you will reuse workflow templates.
Duration: 10-15 minutes
References:
- Reusing workflows
- Sharing workflows with your organization
- Sharing actions and workflows with your enterprise
- Using starter workflows
- For a workflow to be reusable, the
on
must include theworkflow_call
event - Open the workflow file job-dependencies.yml
- Edit the file and update the workflow to run on workflow call event
on:
workflow_call:
- Commit the changes into a new
feature/lab04
branch - Go to
Code
and select thefeature/lab04
from the branches drop down list - Open the workflow file reusable-workflow-template.yml
- Edit the file and copy the following YAML content at the end of the file:
call_dependencies_workflow_job:
needs: call_reusable_workflow_job
uses: <YOUR_USER_ACCOUNT>/gh-abcs-actions/.github/workflows/job-dependencies.yml@main
- Update the workflow to run on push events
on:
push:
branches: [main]
workflow_dispatch:
- Commit the changes into the same
feature/lab04
branch - Open a new pull request from
Pull requests
Make sure it is your repo pull request and not proposed changes to the upstream repo. From the drop down list choose the base repository to be yours.
- Complete the pull request and delete the source branch
- Go to
Actions
and see the details of your running workflow