Skip to content

Commit 0fdc1da

Browse files
authored
Create issue-to-markdown.yml
1 parent 44454aa commit 0fdc1da

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Convert Locked Issues to Markdown
2+
3+
on:
4+
issues:
5+
types: [labeled]
6+
7+
jobs:
8+
issue_to_markdown:
9+
if: contains(github.event.label.name, 'locked')
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
ref: feat/capture-issues
15+
- name: Convert Issue to Markdown
16+
id: convert
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
run: |
20+
issue_number=${{ github.event.issue.number }}
21+
curl -s -H "Authorization: token $GITHUB_TOKEN" \
22+
https://api.github.com/repos/${{ github.repository }}/issues/$issue_number/comments \
23+
> comments.json
24+
mkdir -p issues
25+
echo "# ${{ github.event.issue.title }}" > issues/issue-$issue_number.md
26+
echo "\n\n${{ github.event.issue.body }}" >> issues/issue-$issue_number.md
27+
echo "\n## Comments" >> issues/issue-$issue_number.md
28+
jq -r '.[] | "\n### \(.user.login) commented:\n \(.body)"' comments.json >> issues/issue-$issue_number.md
29+
- name: Commit Markdown
30+
run: |
31+
git config --global user.name 'github-actions'
32+
git config --global user.email 'github-actions@github.com'
33+
git checkout -b feat/capture-issues
34+
git add issues/
35+
git commit -m "Convert locked issue ${{ github.event.issue.number }} to markdown"
36+
git push origin feat/capture-issues

0 commit comments

Comments
 (0)