Using the GitHub CLI and GITHUB_TOKEN to access resources
In this recipe, we will parse the issue from the previous chapter and interact with the issue using the GitHub CLI in the workflow.
Getting ready…
You will need the issue template from the previous chapter. You can create the workflow either in Visual Studio Code or directly in GitHub.
How to do it…
- Create a new workflow
.github/workflows/issue-ops.ymland name itissue-ops:# Issue ops name: issue-ops
- Use the
issuestrigger for the workflow. Note that we are not using thecreatedoreditedevents but ratherlabeled. This allows users to relabel issues when modifying the request:on: issues: types: [labeled]
- Add an
issue-opsjob:jobs: issue-ops:
We only want to run this job for specific labels. Add a condition like the following to the job:
if: ${{ github.event.label.name == 'repo-request' }}The job can run on the latest Ubuntu...