Skip to content

Update README.md

Update README.md #5

name: Create and Close Issue From Commit
on:
push:
branches:
- main # 또는 워치하고 싶은 다른 브랜치
jobs:
create_and_close_issue:
runs-on: ubuntu-latest
steps:
- name: Create and Close Issue
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue = {
owner: context.repo.owner,
repo: context.repo.repo,
title: context.payload.commits[0].message,
body: `Commit details:\n- Author: ${context.payload.commits[0].author.name}\n- Link: ${context.payload.commits[0].url}`
}
github.issues.create(issue).then((issueResponse) => {
github.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueResponse.data.number,
state: 'closed'
});
});