name: Check News Item

on:
  pull_request_target:
    branches:
    - main

permissions:
  pull-requests: write
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest
    name: Check News item
    steps:

      # note: the checkout will pull code from the base branch. This step should not pull code from the merge commit
      - uses: actions/checkout@v3

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.9'
          cache: 'pip'
          cache-dependency-path: 'pyproject.toml'
      - run: pip install PyGithub
      - run: python .github/workflows/check-news.py
        env:
          PR_NUMBER: "${{ github.event.number }}"
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          GITHUB_REPOSITORY: "${{ env.GITHUB_REPOSITORY }}"
