summaryrefslogtreecommitdiffstats
path: root/.github/workflows/add_run_tests_table.yml
blob: 07d481f55f16e39b98fd1e5d215c4454cf1a2667 (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
55
56
57
name: Add run tests table to PR

on:
  pull_request_target:
    types:
      - opened
  workflow_dispatch:
    inputs:
      pr_number:
        description: 'Pull Request number to add run tests table to'
        required: true
        type: number

permissions:
  contents: read
  pull-requests: write

env:
  GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}

jobs:
  add-run-tests-table:
    name: Add run tests table to PR
    runs-on: [ self-hosted, auto-provisioned, build-preset-analytic-node]
    if: >
      (
        github.event_name == 'workflow_dispatch'
      ) ||
      (
        github.event_name == 'pull_request_target' &&
        vars.SHOW_RUN_TESTS_IN_PR == 'TRUE'
      )
    
    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
        with:
          fetch-depth: 1
          sparse-checkout: |
            .github

      - name: Install dependencies
        run: |
          python3 -m pip install --upgrade pip
          pip install PyGithub

      - name: Add run tests table to PR
        env:
          GITHUB_TOKEN: ${{ env.GH_TOKEN }}
          GITHUB_EVENT_PATH: ${{ github.event_path }}
          GITHUB_REPOSITORY: ${{ github.repository }}
          GITHUB_WORKSPACE: ${{ github.workspace }}
          APP_DOMAIN: ${{ vars.APP_DOMAIN }}
          PR_NUMBER: ${{ github.event_name == 'workflow_dispatch' && inputs.pr_number || '' }}
        run: |
          python3 ./.github/scripts/add_run_tests_table.py