-
Notifications
You must be signed in to change notification settings - Fork 538
41 lines (36 loc) · 1.29 KB
/
pull_request.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
40
41
name: Pull request
on:
pull_request:
jobs:
release-template:
# Only run on Release Tracking branch
if: ${{ github.head_ref == 'changeset-release/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Get or Create Comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs')
const body = await fs.readFileSync('.github/release_template.md', 'utf8')
const result = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
const botComments = result.data.filter(c => c.user.login == 'github-actions[bot]')
if (!botComments.length) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body.replace('{{PR_AUTHOR}}', context.payload.sender.login)
})
}