summaryrefslogtreecommitdiffstats
path: root/.github/workflows/validate_pr_description.yml
blob: 46801e131cd9b7072a5a105e620aad9549acb5ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: PR-description

on:
  # # We don't want to support this workflow for now
  # pull_request_target:
  #   types:
  #     - opened
  #     - edited

  #   branches:
  #     - main
  #     - stable-*

  workflow_dispatch:
    inputs:
      pr_number:
        description: 'Pull Request number to validate'
        required: true
        type: string

jobs:
  validate-pr-description:
    runs-on: [ self-hosted, auto-provisioned, build-preset-analytic-node]

    steps:
      - name: Check out the repository
        uses: actions/checkout@v5
        with:
          ref: main

      - name: Get PR body (manual run)
        if: github.event_name == 'workflow_dispatch'
        id: get_pr
        env:
          GITHUB_TOKEN: ${{ github.token }}
          PR_NUMBER: ${{ inputs.pr_number }}
        run: |
          python3 -m pip install PyGithub -q
          python3 ./.github/actions/validate_pr_description/get_pr_body.py

      - name: Use custom PR validation action
        id: validate
        uses: ./.github/actions/validate_pr_description
        with:
          pr_body: ${{ github.event_name == 'workflow_dispatch' && steps.get_pr.outputs.pr_body || github.event.pull_request.body }}

      - name: Test output
        if: always()
        run: echo "Result of validation is  ${{ steps.validate.outputs.status }}"
        

      - name: Set status
        if: failure()
        run: echo "Validation failed."