mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-10 06:52:55 +00:00
Even better handling of approved-for-ci-run label (#5227)
## Problem
We've got `approved-for-ci-run` to work 🎉
But it's still a bit rough, this PR should improve the UX for external
contributors.
## Summary of changes
- `build_and_test.yml`: add `check-permissions` job, which fails if PR is
created from a fork. Make all jobs in the workflow to be dependant on
`check-permission` to fail fast
- `approved-for-ci-run.yml`: add `cleanup` job to close `ci-run/pr-*`
PRs and delete linked branches when the parent PR is closed
- `approved-for-ci-run.yml`: fix the layout for the `ci-run/pr-*` PR
description
- GitHub Autocomment: add a comment with tests result to the original PR
(instead of a PR from `ci-run/pr-*` )
This commit is contained in:
committed by
GitHub
parent
706977fb77
commit
f8a91e792c
@@ -205,8 +205,18 @@ const parseCoverageSummary = async ({ summaryJsonUrl, coverageUrl, fetch }) => {
|
||||
}
|
||||
|
||||
module.exports = async ({ github, context, fetch, report, coverage }) => {
|
||||
// Which PR to comment (for ci-run/pr-* it will comment the parent PR, not the ci-run/pr-* PR)
|
||||
let prToComment
|
||||
const branchName = context.payload.pull_request.base.ref.replace(/^refs\/heads\//, "")
|
||||
const match = branchName.match(/^ci-run\/pr-(?<prNumber>\d+)$/)?.groups
|
||||
if (match) {
|
||||
({ prNumber } = match)
|
||||
prToComment = parseInt(prNumber, 10)
|
||||
} else {
|
||||
prToComment = context.payload.number
|
||||
}
|
||||
// Marker to find the comment in the subsequent runs
|
||||
const startMarker = `<!--AUTOMATIC COMMENT START #${context.payload.number}-->`
|
||||
const startMarker = `<!--AUTOMATIC COMMENT START #${prToComment}-->`
|
||||
// If we run the script in the PR or in the branch (main/release/...)
|
||||
const isPullRequest = !!context.payload.pull_request
|
||||
// Latest commit in PR or in the branch
|
||||
@@ -267,7 +277,7 @@ module.exports = async ({ github, context, fetch, report, coverage }) => {
|
||||
listCommentsFn = github.rest.issues.listComments
|
||||
updateCommentFn = github.rest.issues.updateComment
|
||||
issueNumberOrSha = {
|
||||
issue_number: context.payload.number,
|
||||
issue_number: prToComment,
|
||||
}
|
||||
} else {
|
||||
updateCommentFn = github.rest.repos.updateCommitComment
|
||||
|
||||
Reference in New Issue
Block a user