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 { event: { issue, action } } = JSON.parse(process.env.GITHUB_CONTEXT)
|
||||
const { author_association, body, title, number } = issue
|
||||
const host = process.env.ISSUEHOST
|
||||
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;
|
||||
|
||||
if (author_association === 'OWNER') {
|
||||
if (action === 'edited') {
|
||||
if (author_association === "OWNER") {
|
||||
if (action === "edited") {
|
||||
axios.put(host, {
|
||||
name: title,
|
||||
issueId: number,
|
||||
content: body
|
||||
})
|
||||
} else if (action === 'opened') {
|
||||
content: body,
|
||||
});
|
||||
} else if (action === "opened") {
|
||||
axios.post(host, {
|
||||
name: title,
|
||||
issueId: number,
|
||||
content: body
|
||||
})
|
||||
content: body,
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user