Skip to content

Commit 8d7e574

Browse files
committed
undo last comit
1 parent f6a6be9 commit 8d7e574

File tree

1 file changed

+8
-30
lines changed

1 file changed

+8
-30
lines changed

.github/workflows/duplicate-issue.yml

+8-30
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,27 @@
1-
name: Update Comment with Original Request on Edit
1+
name: Copy Issue Description to Comment with Header
22

33
on:
44
issues:
5-
types: [opened, edited]
5+
types: [opened]
66

77
jobs:
8-
update_comment:
8+
copy_description_to_comment:
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Update comment with header and horizontal rule on issue edit
11+
- name: Copy issue description to comment with header
1212
uses: actions/github-script@v6
1313
with:
1414
github-token: ${{secrets.GITHUB_TOKEN}}
1515
script: |
1616
const issue = context.issue;
1717
const issueBody = context.payload.issue.body;
18-
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
1918
20-
// Create or update a comment with a header, horizontal rule, and the issue description
21-
const commentBody = `### Original Request\n\n-----\n\n${issueBody}`;
19+
// Create a comment with a header and the issue description
20+
const commentBody = `### Original Request\n-------\n\n${issueBody}`;
2221
23-
// Fetch all comments for the issue
24-
const { data: comments } = await octokit.rest.issues.listComments({
22+
await github.rest.issues.createComment({
2523
owner: issue.owner,
2624
repo: issue.repo,
2725
issue_number: issue.number,
26+
body: commentBody
2827
});
29-
30-
// Find a specific comment by its unique header (if it exists)
31-
const originalRequestComment = comments.find(comment => comment.body.startsWith('### Original Request'));
32-
33-
if (originalRequestComment) {
34-
// If the comment exists, update it
35-
await octokit.rest.issues.updateComment({
36-
owner: issue.owner,
37-
repo: issue.repo,
38-
comment_id: originalRequestComment.id,
39-
body: commentBody,
40-
});
41-
} else {
42-
// If the comment does not exist, create it
43-
await octokit.rest.issues.createComment({
44-
owner: issue.owner,
45-
repo: issue.repo,
46-
issue_number: issue.number,
47-
body: commentBody,
48-
});
49-
}

0 commit comments

Comments
 (0)