-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
39 lines (35 loc) · 1.11 KB
/
auto-draft-prs.yml
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
name: Auto Draft
on:
pull_request:
types: [opened]
branches:
- main
permissions:
pull-requests: write
contents: read
issues: write
jobs:
process_pr:
runs-on: ubuntu-latest
steps:
- name: Convert PR to Draft and Add Label
uses: actions/github-script@v6
with:
script: |
// Convert PR to draft
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
draft: true
});
// Check if the PR title includes "docs:" or if it's from a fork
if (context.payload.pull_request.title.includes('docs:') || context.payload.pull_request.head.repo.fork) {
// Add label "No E2E Smoke Needed"
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['No E2E Smoke Needed']
});
}