mirror of
https://github.com/KieSun/all-of-frontend.git
synced 2024-11-22 06:48:13 +08:00
ci: actions
This commit is contained in:
parent
1df8461fe3
commit
27fc8e2d27
15
.github/workflows/issue.yml
vendored
Normal file
15
.github/workflows/issue.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
on:
|
||||
issues:
|
||||
types: [opened, 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.ISSUE }}
|
||||
run: node ./script/issue.js
|
26
1.js
26
1.js
@ -1,26 +0,0 @@
|
||||
const dedup = (data, getKey = () => {} ) => {
|
||||
// todo
|
||||
}
|
||||
let data = [
|
||||
{ id: 1, v: 1 },
|
||||
{ id: 2, v: 2 },
|
||||
{ id: 1, v: 2 },
|
||||
];
|
||||
|
||||
// 以 id 作为排重 key,执行函数得到结果
|
||||
// data = [
|
||||
// { id: 1, v: 1 },
|
||||
// { id: 2, v: 2 },
|
||||
// ];
|
||||
|
||||
let data1 = [
|
||||
{ id: 1, v: 1, id1: 1 },
|
||||
{ id: 2, v: 2, id1: 2 },
|
||||
{ id: 1, v: 2, id1: 1 },
|
||||
]
|
||||
|
||||
// 以 id 和 id1 作为排重 key,执行函数得到结果
|
||||
// data1 = [
|
||||
// { id: 1, v: 1, id1: 1 },
|
||||
// { id: 2, v: 2, id1: 2 },
|
||||
// ];
|
12
script/issue.js
Normal file
12
script/issue.js
Normal file
@ -0,0 +1,12 @@
|
||||
const { event: { issue, action } } = JSON.parse(process.env.GITHUB_CONTEXT)
|
||||
const { author_association, body, title, number } = issue
|
||||
|
||||
console.log(process.env.ISSUEHOST)
|
||||
|
||||
if (author_association === 'OWNER') {
|
||||
if (action === 'edited') {
|
||||
console.log(body, title, number, '----edited')
|
||||
} else if (action === 'opened') {
|
||||
console.log(body, title, number, '----opened')
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user