-
Notifications
You must be signed in to change notification settings - Fork 3k
54 lines (47 loc) · 1.94 KB
/
AddLabel.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
# ADD P0 LABEL IF THE PULL REQUEST IS FROM EXTERNAL PUBLISHER I.E ISV'S
name: "Pull Request Labeler"
on:
pull_request:
branches:
- master
paths:
- Solutions/**
env:
GITHUB_APPS_ID: "${{ secrets.APPLICATION_ID }}"
GITHUB_APPS_KEY: "${{ secrets.APPLICATION_PRIVATE_KEY }}"
jobs:
solutionNameDetails:
if: ${{ github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork && !contains(github.event.pull_request.labels.*.name, 'P0')}}
uses: ./.github/workflows/getSolutionName.yaml
secrets: inherit
solutionPublisherDetail:
needs: solutionNameDetails
if: ${{ github.actor != 'dependabot[bot]' && needs.solutionNameDetails.outputs.solutionName != '' && !github.event.pull_request.head.repo.fork }}
uses: ./.github/workflows/neworexistingsolution.yaml
with:
solutionName: "${{ needs.solutionNameDetails.outputs.solutionName }}"
secrets: inherit
Labeler:
runs-on: ubuntu-latest
needs: solutionPublisherDetail
if: ${{ github.actor != 'dependabot[bot]' && needs.solutionPublisherDetail.outputs.solutionPublisherId != '' && !contains(fromJson(vars.INTERNAL_PUBLISHERS),needs.solutionPublisherDetail.outputs.solutionPublisherId) }}
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@46e4a501e119d39574a54e53a06c9a705efc55c9
with:
app-id: ${{ env.GITHUB_APPS_ID }}
private-key: ${{ env.GITHUB_APPS_KEY }}
- name: Add Label Notification
uses: actions/github-script@b7fb2001b410c9390cbe9e2c7d5cab7eefb7b29c
env:
APPTOKEN: ${{ steps.generate_token.outputs.token }}
with:
github-token: ${{ env.APPTOKEN }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['P0']
})