-
Notifications
You must be signed in to change notification settings - Fork 276
42 lines (39 loc) · 1.52 KB
/
Copy pathclose-pr.yml
File metadata and controls
42 lines (39 loc) · 1.52 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
name: Auto Close PR on build.yml Change
on:
pull_request:
paths:
- '.github/workflows/build.yml'
jobs:
auto-close:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
steps:
- name: Close PR
uses: actions/github-script@v9
with:
script: |
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
state: 'closed'
});
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "🚫 This PR has been automatically closed because it modifies `.github/workflows/build.yml`.\n\nThis workflow file is a usage example and should not be modified as part of the Action logic."
}); await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
state: 'closed'
});
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "This PR has been automatically closed because it modifies `.github/workflows/build.yml`, which is a usage example, not part of the Action logic."
});