-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (29 loc) · 1.02 KB
/
issue-formatter.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
name: Add Text to New Blank Issue
on:
issues:
types:
- opened
jobs:
add_text:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Add text to new blank issue
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue = context.issue; // Gets issue details
const issueBody = context.payload.issue.body; // Gets issue body
if (!issueBody || issueBody.trim() === '') { // Checks if the issue body is empty
const fs = require('fs');
const filePath = '.github/workflows/issue_body.md'; // The location of your file
const fileContent = fs.readFileSync(filePath, 'utf8'); // Reads file content
github.rest.issues.update({
owner: issue.owner,
repo: issue.repo,
issue_number: issue.number,
body: fileContent // Uses the file content as the body
});
}