name: Manifest
on:
  pull_request_target:

permissions:
  contents: read

jobs:
  contribs:
    runs-on: ubuntu-24.04
    permissions:
      pull-requests: write # to create/update pull request comments
    name: Manifest
    steps:
      - name: Checkout the code
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          path: zephyrproject/zephyr
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0
          persist-credentials: false

      - name: Set up Python
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
        with:
          python-version: 3.12
          cache: pip
          cache-dependency-path: scripts/requirements-actions.txt

      - name: Install Python packages
        run: |
          cd zephyrproject/zephyr
          pip install -r scripts/requirements-actions.txt --require-hashes

      - name: west setup
        env:
          BASE_REF: ${{ github.base_ref }}
        working-directory: zephyrproject/zephyr
        run: |
          git config --global user.email "you@example.com"
          git config --global user.name "Your Name"
          west init -l . || true

      - name: Manifest
        uses: zephyrproject-rtos/action-manifest@1729cded3fc798cf0de4a789c596dcb9c40eb14c # v1.9.1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          manifest-path: 'west.yml'
          checkout-path: 'zephyrproject/zephyr'
          use-tree-checkout: 'true'
          check-impostor-commits: 'true'
          label-prefix: 'manifest-'
          verbosity-level: '1'
          labels: 'manifest'
          dnm-labels: 'DNM (manifest)'
          blobs-added-labels: 'Binary Blobs Added'
          blobs-modified-labels: 'Binary Blobs Modified'
