mirror of
https://github.com/KieSun/all-of-frontend.git
synced 2024-11-25 00:08:14 +08:00
chore: actions
This commit is contained in:
parent
bd79888d86
commit
45b0967015
17
.github/workflows/comment.yml
vendored
Normal file
17
.github/workflows/comment.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created, edited]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
issue:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Dump GitHub context
|
||||||
|
env:
|
||||||
|
GITHUB_CONTEXT: ${{ toJSON(github) }}
|
||||||
|
ISSUEHOST: ${{ secrets.ISSUEHOST }}
|
||||||
|
run: |
|
||||||
|
yarn
|
||||||
|
node ./script/issue.js
|
24
script/comment.js
Normal file
24
script/comment.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
const axios = require("axios");
|
||||||
|
const {
|
||||||
|
event: { issue, action },
|
||||||
|
} = JSON.parse(process.env.GITHUB_CONTEXT);
|
||||||
|
const { author_association, body, title, number } = issue;
|
||||||
|
const host = process.env.ISSUEHOST;
|
||||||
|
|
||||||
|
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,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
@ -1,20 +1,22 @@
|
|||||||
const axios = require('axios')
|
const axios = require("axios");
|
||||||
const { event: { issue, action } } = JSON.parse(process.env.GITHUB_CONTEXT)
|
const {
|
||||||
const { author_association, body, title, number } = issue
|
event: { issue, action },
|
||||||
const host = process.env.ISSUEHOST
|
} = JSON.parse(process.env.GITHUB_CONTEXT);
|
||||||
|
const { author_association, body, title, number } = issue;
|
||||||
|
const host = process.env.ISSUEHOST;
|
||||||
|
|
||||||
if (author_association === 'OWNER') {
|
if (author_association === "OWNER") {
|
||||||
if (action === 'edited') {
|
if (action === "edited") {
|
||||||
axios.put(host, {
|
axios.put(host, {
|
||||||
name: title,
|
name: title,
|
||||||
issueId: number,
|
issueId: number,
|
||||||
content: body
|
content: body,
|
||||||
})
|
});
|
||||||
} else if (action === 'opened') {
|
} else if (action === "opened") {
|
||||||
axios.post(host, {
|
axios.post(host, {
|
||||||
name: title,
|
name: title,
|
||||||
issueId: number,
|
issueId: number,
|
||||||
content: body
|
content: body,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user