all-of-frontend/script/issue.js

20 lines
550 B
JavaScript
Raw Normal View History

2021-03-22 21:59:51 +08:00
const axios = require('axios')
2021-03-22 21:42:21 +08:00
const { event: { issue, action } } = JSON.parse(process.env.GITHUB_CONTEXT)
const { author_association, body, title, number } = issue
2021-03-22 21:59:51 +08:00
const host = process.env.ISSUEHOST
2021-03-22 21:42:21 +08:00
if (author_association === 'OWNER') {
if (action === 'edited') {
2021-03-22 21:59:51 +08:00
axios.put(host, {
name: title,
issueId: number,
content: body
})
2021-03-22 21:42:21 +08:00
} else if (action === 'opened') {
2021-03-22 21:59:51 +08:00
axios.post(host, {
name: title,
issueId: number,
content: body
})
2021-03-22 21:42:21 +08:00
}
}