---
name: Linting

on:
  pull_request:

jobs:
  dco:
    name: DCO in Commit Message(s)
    runs-on: ubuntu-latest
    steps:
      - name: Get PR commits
        id: 'get-pr-commits'
        uses: tim-actions/get-pr-commits@master
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
      - name: Run DCO check
        uses: tim-actions/dco@master
        with:
          commits: ${{ steps.get-pr-commits.outputs.commits }}

  gitlint:
    name: Commit Message(s)
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Run gitlint
        run: make gitlint

  golangci-lint:
    name: Go
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repository
        uses: actions/checkout@v2
      - name: Run golangci-lint
        run: make golangci-lint

  markdown-link-check:
    name: Markdown Links (modified files)
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repository
        uses: actions/checkout@v2

      - name: Run markdown-link-check
        uses: gaurav-nelson/github-action-markdown-link-check@v1
        with:
          config-file: ".markdownlinkcheck.json"
          check-modified-files-only: "yes"
          base-branch: ${{ github.base_ref }}

  markdownlint:
    name: Markdown
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repository
        uses: actions/checkout@v2
      - name: Run markdownlint
        run: make markdownlint

  yaml-lint:
    name: YAML
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repository
        uses: actions/checkout@v2
      - name: Run yamllint
        run: make yamllint
