chore: action

This commit is contained in:
虚无 2021-03-23 11:04:05 +08:00
parent 45b0967015
commit bbb46d851e
2 changed files with 21 additions and 22 deletions

View File

@ -11,7 +11,7 @@ jobs:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
ISSUEHOST: ${{ secrets.ISSUEHOST }}
COMMENTHOST: ${{ secrets.COMMENTHOST }}
run: |
yarn
node ./script/issue.js
node ./script/comment.js

View File

@ -1,24 +1,23 @@
const axios = require("axios");
const {
event: { issue, action },
event: { comment },
} = JSON.parse(process.env.GITHUB_CONTEXT);
const { author_association, body, title, number } = issue;
const host = process.env.ISSUEHOST;
const {
body,
updated_at,
html_url,
id,
user: { avatar_url, login },
issue: { number },
} = comment;
const host = process.env.COMMENTHOST;
console.log(JSON.parse(process.env.GITHUB_CONTEXT););
// if (author_association === "OWNER") {
// if (action === "edited") {
// axios.put(host, {
// name: title,
// issueId: number,
// content: body,
// });
// } else if (action === "opened") {
// axios.post(host, {
// name: title,
// issueId: number,
// content: body,
// });
// }
// }
axios.post(host, {
issueId: number,
commentId: id,
htmlUrl: html_url,
userName: login,
avatarUrl: avatar_url,
content: body,
updatedAt: updated_at,
});