-
-
Notifications
You must be signed in to change notification settings - Fork 104
62 lines (62 loc) · 2.32 KB
/
pull_request_labeler.yaml
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
58
59
60
61
62
name: pull_request_labeler
on:
pull_request:
types: [edited, opened, synchronize, reopened]
jobs:
# Check if the pull request is a fork
# We can assign labels to a pull request only if it originates from the original repository. If a
# contributor forks the repository and creates a pull request from their forked version, the labeler
# actions do not have permission to access the PR's content, thus unable to automatically add
# labels. In such cases, the repository maintainers will need to add labels manually until a
# better solution is found.
check_repository_origin:
runs-on: ubuntu-22.04
outputs:
fork: ${{ steps.check_repository_origin.outputs.fork }}
steps:
- name: Check the Pull Request origin
id: check_repository_origin
run: |
if [ "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.event.pull_request.base.repo.full_name }}" ]; then
echo "Pull Request is from the original repository."
echo "fork=false" >> $GITHUB_OUTPUT
else
echo "Pull Request is from a forked repository."
echo "fork=true" >> $GITHUB_OUTPUT
fi
# Auto assigne reviewers and PR author
add-reviews:
needs: check_repository_origin
runs-on: ubuntu-22.04
if: ${{ needs.check_repository_origin.outputs.fork == 'false' }}
steps:
- uses: kentaro-m/[email protected]
with:
configuration-path: .github/config/auto-assign.yml
# Add source labels to the PR
label_based_on_source_lang:
permissions:
contents: read
pull-requests: write
needs: check_repository_origin
runs-on: ubuntu-22.04
if: ${{ needs.check_repository_origin.outputs.fork == 'false' }}
steps:
- uses: actions/labeler@v4
with:
configuration-path: .github/config/labeler.yml
# Add scope & type labels to the PR
label_based_on_title:
permissions:
contents: read
pull-requests: write
needs: check_repository_origin
runs-on: ubuntu-22.04
if: ${{ needs.check_repository_origin.outputs.fork == 'false' }}
steps:
- uses: github/[email protected]
with:
configuration-path: .github/config/title_label_config.yml
include-title: 1
repo-token: ${{ github.token }}
enable-versioned-regex: 0