-
Notifications
You must be signed in to change notification settings - Fork 14.8k
68 lines (62 loc) · 2.56 KB
/
extended_tests.yml
File metadata and controls
68 lines (62 loc) · 2.56 KB
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
63
64
65
66
67
68
name: Extended Tests
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
actions: none
checks: none
contents: none
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
# This action can update/close pull requests
pull-requests: write
repository-projects: none
security-events: none
statuses: none
on:
pull_request_target:
branches:
- '*'
paths:
- '**/**ldap**'
- '**/**kerberos**'
- '**/**gss**'
jobs:
add-labels:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
// NOTE: The following section is JavaScript. Note that backticks will need to be escaped within
// the multiline comment strings in the following config. When editing this file, using JavaScript
// syntax highlighting might be easier.
//
// This script has intentionally been inlined instead of using third-party Github actions for both
// security and performance reasons.
const currentLabelNames = context.payload.pull_request.labels.map(label => label.name);
const newLabelName = "additional-testing-required";
const comment = `
Thanks for your pull request! As part of our landing process, we manually verify that all modules work as expected.
We've added the \`${newLabelName}\` label to indicate that additional testing is required before this pull request can be merged.
For maintainers, this means visiting [here](https://jenkins-metasploit.build.r7ops.com/job/pro_manual_test_trigger/).
`;
if (!currentLabelNames.includes(newLabelName)) {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [newLabelName]
});
const precedingWhitespaceLength = comment.split("\n")[1].search(/\S/);
const commentWithoutPrecedingWhitespace = comment.split("\n").map(line => line.substring(precedingWhitespaceLength)).join("\n").trim();
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentWithoutPrecedingWhitespace
});
}