This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Copy Issue Description to Comment with Header | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
copy_description_to_comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Copy issue description to comment with header | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const issue = context.issue; | |
const issueBody = context.payload.issue.body; | |
// Create a comment with a header and the issue description | |
const commentBody = `### Original Request\n-------\n\n${issueBody}`; | |
await github.rest.issues.createComment({ | |
owner: issue.owner, | |
repo: issue.repo, | |
issue_number: issue.number, | |
body: commentBody | |
}); |