Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use org-wide reusable workflow for actionlint #43

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 }}
13 changes: 0 additions & 13 deletions .github/workflows/reviewdog.yml

This file was deleted.