wip
This commit is contained in:
parent
b60121527d
commit
e8b42d7e16
20 changed files with 354 additions and 377 deletions
24
src/queue/processors/http/report-github-failure.ts
Normal file
24
src/queue/processors/http/report-github-failure.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import * as request from 'request-promise-native';
|
||||
import User from '../../models/user';
|
||||
const createPost = require('../../server/api/endpoints/posts/create');
|
||||
|
||||
export default async ({ data }) => {
|
||||
const asyncBot = User.findOne({ _id: data.userId });
|
||||
|
||||
// Fetch parent status
|
||||
const parentStatuses = await request({
|
||||
url: `${data.parentUrl}/statuses`,
|
||||
headers: {
|
||||
'User-Agent': 'misskey'
|
||||
},
|
||||
json: true
|
||||
});
|
||||
|
||||
const parentState = parentStatuses[0].state;
|
||||
const stillFailed = parentState == 'failure' || parentState == 'error';
|
||||
const text = stillFailed ?
|
||||
`**⚠️BUILD STILL FAILED⚠️**: ?[${data.message}](${data.htmlUrl})` :
|
||||
`**🚨BUILD FAILED🚨**: →→→?[${data.message}](${data.htmlUrl})←←←`;
|
||||
|
||||
createPost({ text }, await asyncBot);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue