llvm-project

Форк
0
75 строк · 2.8 Кб
1
name: "Labelling new pull requests"
2

3
permissions:
4
  contents: read
5

6
on:
7
  # It's safe to use pull_request_target here, because we aren't checking out
8
  # code from the pull request branch.
9
  # See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
10
  pull_request_target:
11
    types:
12
      - opened
13
      - reopened
14
      - ready_for_review
15
      - synchronize
16

17
jobs:
18
  greeter:
19
    runs-on: ubuntu-latest
20
    permissions:
21
      pull-requests: write
22
    # Only comment on PRs that have been opened for the first time, by someone
23
    # new to LLVM or to GitHub as a whole. Ideally we'd look for FIRST_TIMER
24
    # or FIRST_TIME_CONTRIBUTOR, but this does not appear to work. Instead check
25
    # that we do not have any of the other author associations.
26
    # See https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_request
27
    # for all the possible values.
28
    if: >-
29
      (github.repository == 'llvm/llvm-project') &&
30
      (github.event.action == 'opened') &&
31
      (github.event.pull_request.author_association != 'COLLABORATOR') &&
32
      (github.event.pull_request.author_association != 'CONTRIBUTOR') &&
33
      (github.event.pull_request.author_association != 'MANNEQUIN') &&
34
      (github.event.pull_request.author_association != 'MEMBER') &&
35
      (github.event.pull_request.author_association != 'OWNER')
36
    steps:
37
      - name: Checkout Automation Script
38
        uses: actions/checkout@v4
39
        with:
40
          sparse-checkout: llvm/utils/git/
41
          ref: main
42

43
      - name: Setup Automation Script
44
        working-directory: ./llvm/utils/git/
45
        run: |
46
          pip install --require-hashes -r requirements.txt
47

48
      - name: Greet Author
49
        working-directory: ./llvm/utils/git/
50
        run: |
51
          python3 ./github-automation.py \
52
            --token '${{ secrets.GITHUB_TOKEN }}' \
53
            pr-greeter \
54
            --issue-number "${{ github.event.pull_request.number }}"
55

56
  automate-prs-labels:
57
    # Greet first so that only the author gets that notification.
58
    needs: greeter
59
    runs-on: ubuntu-latest
60
    # Ignore PRs with more than 10 commits.  Pull requests with a lot of
61
    # commits tend to be accidents usually when someone made a mistake while trying
62
    # to rebase.  We want to ignore these pull requests to avoid excessive
63
    # notifications.
64
    # always() means that even if greeter is skipped, this job will run.
65
    if: >
66
      always() && github.repository == 'llvm/llvm-project' &&
67
      github.event.pull_request.draft == false &&
68
      github.event.pull_request.commits < 10
69
    steps:
70
      - uses: actions/labeler@v4
71
        with:
72
          configuration-path: .github/new-prs-labeler.yml
73
          # workaround for https://github.com/actions/labeler/issues/112
74
          sync-labels: ''
75
          repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}
76

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.