Linting workflows
In this recipe, we’ll add a linting action that will check the workflow and give feedback directly in the pull request.
Getting ready…
Open the workflow file in the branch that you have for the open pull request. Do not merge the changes yet.
How to do it…
- Go to the marketplace and search for the
actionlint
. The action we are looking for is fromdevops-actions
. The action needs to access the workflow files, meaning you have to check out the repository using the checkout action first. Add the following two steps to the end of the job:- uses: actions/[email protected] - uses: devops-actions/[email protected]
- As we want the action to annotate errors in pull requests, we have to give the workflow write access to pull requests. I’ll explain later how this works. For now, just add a section permissions to the job like this:
jobs: job1: runs-on: ubuntu-latest permissions...