# This job runs containerd shared project-checks, that verifies licenses, headers, and commits.
# To run locally, you may just use `make lint` instead, that does the same thing
# (albeit `make lint` uses more modern versions).
name: job-lint-project

on:
  workflow_call:
    inputs:
      timeout:
        required: true
        type: number
      go-version:
        required: true
        type: string
      runner:
        required: true
        type: string

env:
  GOTOOLCHAIN: local

jobs:
  project:
    name: "commits, licenses..."
    timeout-minutes: ${{ inputs.timeout }}
    runs-on: ${{ inputs.runner }}
    defaults:
      run:
        shell: bash

    steps:
      - name: "Init: checkout"
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2
        with:
          fetch-depth: 100
          path: src/github.com/containerd/nerdctl

      - name: "Init: install go"
        uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5  # v5.5.0
        with:
          go-version: ${{ inputs.go-version }}
          check-latest: true
          cache-dependency-path: src/github.com/containerd/nerdctl

      - name: "Run"
        uses: containerd/project-checks@d7751f3c375b8fe4a84c02a068184ee4c1f59bc4  # v1.2.2
        with:
          working-directory: src/github.com/containerd/nerdctl
          repo-access-token: ${{ secrets.GITHUB_TOKEN }}
          # go-licenses-ignore is set because go-licenses cannot detect the license of the following package:
          # * go-base36: Apache-2.0 OR MIT (https://github.com/multiformats/go-base36/blob/master/LICENSE.md)
          #
          # The list of the CNCF-approved licenses can be found here:
          # https://github.com/cncf/foundation/blob/main/allowed-third-party-license-policy.md
          go-licenses-ignore: |
            github.com/multiformats/go-base36
