name: check docker files compliance

on:
  pull_request:
    paths:
      - .github/workflows/docker_compliance.yml
      - '**Dockerfile**'
  push:
    branches:
      - main
      - 'release/*'

jobs:
  lint:
    runs-on: ubuntu-latest
    container:
      image: hadolint/hadolint@sha256:27173fe25e062448490a32de410c08491c626a0bef360aa2ce5d5bdd9384b50d #2.12.0-debian
    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

      - name: Lint All Dockerfiles (except third_party)
        run: find  . -name "*Dockerfile*" -not -path "./third_party/*" -exec hadolint -V {} \;
      - name: Slack Notification
        if: ${{ failure() && github.ref == 'refs/heads/main' }}
        continue-on-error: true
        uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990
        env:
          SLACK_COLOR: ${{ job.status }}
          SLACK_MESSAGE: "lint finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
