This commit is contained in:
Ciro Santilli
2022-08-03 04:01:12 +00:00
parent 79fc2631d6
commit 5c67872104

View File

@@ -189,6 +189,8 @@ try {
labels: Array.from([...labels, ...newLabels])
})
}
// Get the latest news from duty-machine.
{
const commits = await octokit.rest.repos.listCommits({
owner: 'duty-machine',
repo: 'news',
@@ -217,6 +219,20 @@ try {
path: filename,
})
console.log('content: ' + require('util').inspect(content, { depth: null }));
contentS = Buffer.from(content.data.content, 'base64').toString('utf-8')
const lines = contentS.split('\n')
const titleAndLink = lines[2]
const match = titleAndLink.match(/\[([^\]]+)\]\(([^)]+)\)/)
const title = match[1]
const link = match[2]
const body = lines[5]
const new_issue = octokit.issues.create({
owner: payload.repository.owner.login,
repo: payload.repository.name,
title,
body: content.data.html_url + '\n\n' + link + '\n\n' + body,
})
}
} catch (error) {
core.setFailed(error.message);
}