mirror of
https://github.com/kubesphere/website.git
synced 2025-12-25 15:32:54 +00:00
chore: block message notifications from PRs and bots
Signed-off-by: Zhengyi Lai <zheng1@kubesphere.io>
This commit is contained in:
parent
3783c4dacb
commit
16b5842e47
|
|
@ -20,9 +20,10 @@ jobs:
|
||||||
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
console.log(context);
|
console.log(JSON.stringify(context, null, 2));
|
||||||
if (context.payload.sender.login === "ks-ci-bot") return;
|
if (context.payload.sender.login === "ks-ci-bot") return;
|
||||||
const axios = require('axios');
|
if (context.payload.sender.type === 'Bot') return;
|
||||||
|
if (context.payload.issue.html_url.indexOf('/pull/') > 0) return;
|
||||||
const issue = context.payload.issue;
|
const issue = context.payload.issue;
|
||||||
const comment = context.payload.comment;
|
const comment = context.payload.comment;
|
||||||
var subject = {};
|
var subject = {};
|
||||||
|
|
@ -34,12 +35,12 @@ jobs:
|
||||||
action = "issue";
|
action = "issue";
|
||||||
subject = issue;
|
subject = issue;
|
||||||
};
|
};
|
||||||
const payload = {
|
const webhook_body = {
|
||||||
msgtype: 'markdown',
|
msgtype: 'markdown',
|
||||||
markdown: {
|
markdown: {
|
||||||
content: `[${context.payload.sender.login}](${context.payload.sender.html_url}) ${context.payload.action} ${action} [${issue.title}](${subject.html_url})\n${subject.body}`,
|
content: `[${context.payload.sender.login}](${context.payload.sender.html_url}) ${context.payload.action} ${action} [${issue.title}](${subject.html_url})\n${subject.body}`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const formattedPayload = JSON.stringify(payload, null, 2);
|
console.log(JSON.stringify(webhook_body, null, 2));
|
||||||
console.log(formattedPayload);
|
const axios = require('axios');
|
||||||
await axios.post(process.env.WEBHOOK_URL, payload);
|
await axios.post(process.env.WEBHOOK_URL, webhook_body);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue