Skip to content

TodoList 2024년 8월 1일 #9

TodoList 2024년 8월 1일

TodoList 2024년 8월 1일 #9

Workflow file for this run

name: Issue Closed
on:
issues:
types: [closed]
jobs:
create-md:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: main
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Create issue markdown file
run: |
ISSUE_NUMBER="${{ github.event.issue.number }}"
ISSUE_TITLE="${{ github.event.issue.title }}"
ISSUE_BODY="${{ github.event.issue.body }}"
ISSUE_USER="${{ github.event.issue.user.login }}"
# 파일명으로 사용할 수 없는 문자 제거 및 변환
SANITIZED_ISSUE_TITLE=$(echo "${ISSUE_TITLE}" | sed 's/[^a-zA-Z0-9가-힣]/-/g' | tr -s '-' | sed 's/^-//' | sed 's/-$//')
FILE_NAME="TodoList/${SANITIZED_ISSUE_TITLE}.md"
mkdir -p TodoList
echo "# Issue #${ISSUE_NUMBER}: ${ISSUE_TITLE}" > "$FILE_NAME"
echo "" >> "$FILE_NAME"
echo "## Created by: ${ISSUE_USER}" >> "$FILE_NAME"
echo "" >> "$FILE_NAME"
echo "${ISSUE_BODY}" >> "$FILE_NAME"
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Add markdown file for closed issue #${ISSUE_NUMBER}"
git pull --rebase origin main
git push origin main