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
onmust include theworkflow_callevent - 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/lab04branch - Go to
Codeand select thefeature/lab04from 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/lab04branch - Open a new pull request from
Pull requests
Make sure it is your repository pull request and not proposed changes to the upstream repository. From the drop down list choose the base repository to be yours.
- Complete the pull request and delete the source branch
- Go to
Actionsand see the details of your running workflow