-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (52 loc) · 1.63 KB
/
actionlint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Duplicated from: https://github.com/fac/shared-workflows/blob/main/.github/workflows/actionlint.yml
# Using this public repo as a de facto public mirror for the shared workflow
name: Lint workflow files
on:
push:
paths:
- '.github/workflows/*.yml'
- '.github/workflows/*.yaml'
pull_request:
types:
- opened
- reopened
- synchronize
paths:
- '.github/workflows/*.yml'
- '.github/workflows/*.yaml'
workflow_call:
permissions:
pull-requests: write
contents: read
env:
REVIEWDOG_REPORTER: ${{ github.event_name == 'pull_request' && 'github-pr-review' || 'github-check' }}
jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- name: Find PR
if: ${{ ! contains(env.REVIEWDOG_REPORTER, 'pr') }}
id: pr
env:
GH_TOKEN: ${{ secrets.github_token }}
run: |
pr_number="$(gh api graphql -f query='{
repository(name:"${{ github.event.repository.name }}", owner:"${{ github.repository_owner }}") {
object(oid:"${{ github.sha }}") {
... on Commit {
associatedPullRequests(first:1) {
nodes {
number
}
}
}
}
}
}' --jq '.data.repository.object.associatedPullRequests.nodes[].number')"
echo "number=$pr_number" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v3
- uses: reviewdog/action-actionlint@v1.37.1
if: ${{ ! steps.pr.outputs.number }}
with:
fail_on_error: true
reporter: ${{ env.REVIEWDOG_REPORTER }}