sbepp: add version 1.4.1 #70180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: hooks warnings | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
comment: | |
if: ${{ github.event.issue.pull_request && github.event.sender.login == 'conan-center-bot' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
warnings_map = new Map() | |
const link_regex = /\[All logs\]\((?<url>https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*))\)/g; | |
for (const match of context.payload.comment.body.matchAll(link_regex)) | |
{ | |
prefix = "https://c3i.jfrog.io/c3i/misc/summary.html?json=" | |
if(!match.groups.url.startsWith(prefix)) | |
continue; | |
url = match.groups.url.slice(prefix.length) | |
try { | |
result = await github.request({ | |
url: url, | |
}); | |
} catch(err) { | |
core.warning(`error ${err.status} for url ${err.request.url}`) | |
continue | |
} | |
for (const job of result.data) | |
{ | |
if (job.build == null) | |
continue; | |
try { | |
log = await github.request({ | |
baseUrl: "https://c3i.jfrog.io/c3i/misc/", | |
url: job.build, | |
}); | |
} catch(err) { | |
core.warning(`error ${err.status} for url ${err.request.url}`) | |
continue | |
} | |
prefix = "[HOOK - conan-center.py] " | |
warnings = log.data.split("\n").filter(line => line.startsWith(prefix) && line.includes(" WARN: ")) | |
if(warnings.length == 0) | |
continue | |
if(!warnings_map.has(job.reference)) | |
warnings_map.set(job.reference, new Set()) | |
for(const warning of warnings) | |
{ | |
msg = warning.slice(prefix.length) | |
warnings_map.get(job.reference).add(msg) | |
core.warning(msg) | |
} | |
} | |
} | |
if(warnings_map.size > 0) | |
{ | |
comment = "<details>\n" | |
comment += "<summary>Hooks produced the following warnings" | |
const shaRegex = /(All green|Failure) in build \d+ \(`(?<sha>(\d|[a-z])+)`\):/g; | |
const shaMatch = shaRegex.exec(context.payload.comment.body) | |
if(shaMatch) | |
{ | |
comment += " for commit " + shaMatch.groups.sha | |
} | |
comment += "</summary>\n\n" | |
for (const [ref, warnings] of warnings_map) | |
{ | |
comment += "<details>\n" | |
comment += "<summary>" + ref + "</summary>\n\n```\n" | |
for(const warning of warnings) | |
comment += warning + "\n" | |
comment += "```\n</details>\n" | |
} | |
comment += "</details>\n" | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: comment | |
}) | |
} |