diff --git a/.github/workflows/dismiss-stale-reviews.yml b/.github/workflows/dismiss-stale-reviews.yml index 30cb18dad77..d2c099385de 100644 --- a/.github/workflows/dismiss-stale-reviews.yml +++ b/.github/workflows/dismiss-stale-reviews.yml @@ -19,11 +19,22 @@ # approval to the new head by itself after a push that leaves the diff of the pull request as it was, such as a rebase # or a merge of the base branch, so those approvals are kept. # +# GitHub does not move an approval over a merge of the base branch that had conflicts, since resolving them changes +# the diff of the pull request. Such an update merge is not a change of the pull request to review again, so the +# approval is kept as well, as long as every commit pushed after it is a merge of the base branch that differs from +# the merge git makes by itself only inside the conflicts git could not merge, and resolves each of them as a whole: +# one side, the other, or both. Any other resolution is a change like any other. The pull request then gets a comment +# naming the files whose conflicts were resolved, once for each merge, since nobody reviewed the resolution. A merge +# that changes any other line, or that merges anything but the base branch, dismisses the approval like any other +# push, and so does a walk over the merges that cannot finish, because a request fails or the walk takes more than +# its two minutes. How many merges follow the approval does not matter. +# # A pull_request run from a fork gets a read-only token that cannot dismiss a review, so this workflow does not react # to the pull request. It reacts to the Code Style workflow being requested for one, which a push to a pull request # does, even for a draft or a pull request labelled "no ci", whose jobs are then skipped. A workflow_run run uses the # workflow file of the default branch and a token of this repository, and it never checks out or runs anything of the -# pull request: it only reads commit ids through the API. +# pull request: it reads commit ids through the API and, to repeat a merge, fetches the trees of its commits and +# merges them in a bare repository, which runs no hook and no filter. # # Not every push requests the Code Style workflow: GitHub starts no pull_request workflow for a commit whose message # asks to skip them ("[skip ci]" and its variants), nor for a pull request that conflicts with its base branch. So @@ -61,13 +72,195 @@ jobs: # Empty on a scheduled and on a manual run, which look at every open pull request. SHA: ${{ github.event.workflow_run.head_sha }} run: | + # A check of the merges after an approval has two minutes, and all of them together have seven, which + # leaves the job three for the rest before its timeout. Each git and gh command a check runs gets what is + # left: a request or a fetch left to hang, or one pull request with a long run of merges, would otherwise + # end the job at its timeout, and with it the dismissals of every pull request after that one, on each run. + export GIT_LITERAL_PATHSPECS=1 + checks_end=$(( SECONDS + 420 )) + bounded() { + local left=$(( deadline - SECONDS )) + (( left > 0 )) || return 124 + timeout "$left" "$@" + } + # A request of the check, asked again once after a pause when it fails, as long as the check has time left: + # an approval kept this way is checked again on every hourly run, and one passing error of the API should + # not dismiss it. Only the answer of the request that succeeds is printed, not the error body gh prints. + requested() { + local answer + answer=$(bounded gh api "$@") || { + (( deadline - SECONDS > 5 )) || return 124 + sleep 5 + answer=$(bounded gh api "$@") || return + } + printf '%s\n' "$answer" + } + # Whether a merge commit changed a conflicted file only inside its conflicts. The file git merges by itself + # holds each conflict between markers labelled with the two parents, and the pushed file has to keep every + # line outside them as it is, with the same mode. Answers 1 when it does not, also for a conflict git + # writes without markers, such as one of a binary file or of a file deleted on one side, which leaves no + # line to tell the resolution by; and 2 when a git command fails. + resolved_within_conflicts() { + local tree=$1 commit=$2 path=$3 first=$4 second=$5 entry pushed regions hunks + entry=$(bounded git -C merges.git ls-tree --format='%(objectmode) %(objecttype)' "$tree" -- "$path") || return 2 + [[ "$entry" == 100*' blob' ]] || return 1 + pushed=$(bounded git -C merges.git ls-tree --format='%(objectmode) %(objecttype)' "$commit" -- "$path") || return 2 + [[ "$pushed" == "$entry" ]] || return 1 + bounded git -C merges.git cat-file blob "$tree:$path" > conflicted.file || return 2 + bounded git -C merges.git cat-file blob "$commit:$path" > resolved.file || return 2 + # The first and last line of each conflict. A marker is matched with its label, the id of a parent, so + # that a line of the file that merely looks like one does not open a conflict. + regions=$(awk -v opening="<<<<<<< $first" -v closing=">>>>>>> $second" ' + { sub(/\r$/, "") } + $0 == opening || index($0, opening ":") == 1 { if (start) exit 1; start = NR; next } + $0 == closing || index($0, closing ":") == 1 { if (!start) exit 1; printf "%d %d ", start, NR; start = 0 } + END { if (start) exit 1 }' conflicted.file) || return 2 + [[ -n "$regions" ]] || return 1 + # Every line the merge commit removed or replaced lies in a conflict, markers included, and every line it + # only inserted lands between the markers of one: git reports an insertion after an old line, so that + # line has to be the opening marker or a line after it, before the closing marker. Each conflict is then + # resolved as a whole, by what git offers for one: the lines of the pull request's side, those of the + # base branch's side, or both sides one after the other, in either order. Lines picked from the sides, + # repeated, reordered or written by hand are a change nobody reviewed, even when each line looks like + # one of a side. A conflict left as git wrote it, markers and all, is no change either. --text makes git + # compare a file it takes for binary line by line too, rather than only say that it differs. + hunks=$(bounded git -C merges.git diff -U0 --text --no-ext-diff --no-textconv --no-color "$tree:$path" "$commit:$path") || return 2 + awk -v regions="$regions" ' + BEGIN { n = split(regions, r, " ") } + FILENAME == ARGV[1] { merged[FNR] = $0; next } + FILENAME == ARGV[2] { resolved[FNR] = $0; next } + /^@@ / { + split(substr($2, 2), h, ","); at = h[1] + 0; count = (2 in h) ? h[2] + 0 : 1 + split(substr($3, 2), g, ","); written = (2 in g) ? g[2] + 0 : 1; conflict = 0 + for (i = 1; i < n; i += 2) + if (count > 0 ? (r[i] <= at && at + count - 1 <= r[i + 1]) : (r[i] <= at && at < r[i + 1])) conflict = i + if (!conflict) { outside = 1; exit 1 } + grown[conflict] += written - count + } + # The resolution of each conflict is where its lines moved to in the pushed file, as far as the + # changes before it and in it have shifted them. + END { + if (outside) exit 1 + for (i = 1; i < n; i += 2) { + from = r[i] + shift; to = r[i + 1] + shift + grown[i]; shift += grown[i] + resolution = ""; for (j = from; j <= to; j++) resolution = resolution resolved[j] "\n" + conflict = ""; ours = ""; theirs = ""; separators = 0 + for (j = r[i]; j <= r[i + 1]; j++) conflict = conflict merged[j] "\n" + for (j = r[i] + 1; j < r[i + 1]; j++) + if (merged[j] ~ /^=======\r?$/) separators++ + else if (separators) theirs = theirs merged[j] "\n" + else ours = ours merged[j] "\n" + if (resolution == conflict) continue + if (separators != 1) exit 1 + if (resolution != ours && resolution != theirs && resolution != ours theirs && resolution != theirs ours) exit 1 + } + }' conflicted.file resolved.file - <<< "$hunks" || return 1 + } + # Whether every commit from the approved one to the head is a merge of the base branch that changes nothing + # by hand outside the conflicts git could not merge. Each commit on the way has to have two parents, the + # second one a commit of the base branch, and its tree is compared with the one git merges from those + # parents: the files that differ have to be conflicted ones, changed only inside their conflicts. Three + # commits are fetched for a merge, its parents and their merge base, without history and without file + # contents; git then asks for the contents of the files changed on both sides, and of the conflicted files + # of the merge commit. The parents of the head are asked for, those of every merge after it are read from + # the commit already fetched, so a merge costs two requests. Sets the reason of a dismissal, and lists the + # files whose conflicts were resolved by hand, one line with the merge and the file each. A commit that is + # not such a merge answers no, and so does anything that keeps the check from finishing: a failed request, + # or a git command that fails or runs out of time. The number of merges is not limited, only the time: + # GitHub does not move an approval kept this way, so each hourly run walks its merges again, and the time + # limit is what bounds that cost. + only_merges_base() { + local base=$1 approved=$2 commit=$3 deadline=$(( SECONDS + 120 )) fork= parents first second other behind merged tree conflicts changed path + (( deadline <= checks_end )) || deadline=$checks_end + accepted= + reason="the commits after this approval could not be checked" + while [[ "$commit" != "$approved" ]]; do + # The parents are read into a variable first, so that a failed command answers as one: gh prints the + # body of a failed request, which split into words would look like a commit with more than two parents. + if [[ -n "$fork" ]]; then + # The commit was fetched as the first parent of the merge before it, so its parents are read from it. + parents=$(set -o pipefail; bounded env GIT_NO_LAZY_FETCH=1 git -C merges.git cat-file commit "$commit" | sed -n '1,/^$/s/^parent //p' | tr '\n' ' ') || return 1 + else + parents=$(requested "repos/$REPO/commits/$commit" --jq '[.parents[].sha] | join(" ")') || return 1 + fi + read -r first second other <<< "$parents" + [[ -n "$first" ]] || return 1 + [[ -n "$second" && -z "$other" ]] || { reason="the pull request changed after this approval"; return 1; } + behind=$(requested "repos/$REPO/compare/$second...$base?per_page=1" --jq '.behind_by') || return 1 + [[ "$behind" == 0 ]] || { reason="the pull request changed after this approval"; return 1; } + fork=$(requested "repos/$REPO/compare/$first...$second?per_page=1" --jq '.merge_base_commit.sha') || return 1 + [[ -n "$fork" ]] || return 1 + bounded git -C merges.git fetch --quiet --depth=1 --filter=blob:none origin "$commit" "$first" "$second" "$fork" || return 1 + # The first line is the merged tree, the lines after it name the conflicted files, which fail the command. + merged=$(bounded git -C merges.git -c merge.conflictStyle=merge merge-tree --write-tree --name-only --no-messages --merge-base="$fork" "$first" "$second") || [[ $? == 1 ]] || return 1 + tree=${merged%%$'\n'*} + conflicts=$(tail -n +2 <<< "$merged") + changed=$(bounded git -C merges.git diff --name-only --no-renames "$tree" "$commit^{tree}") || return 1 + while IFS= read -r path; do + [[ -n "$path" ]] || continue + grep -qxF -- "$path" <<< "$conflicts" || { reason="the pull request changed after this approval"; return 1; } + resolved_within_conflicts "$tree" "$commit" "$path" "$first" "$second" || { + (( $? == 1 )) && reason="the pull request changed after this approval" + return 1 + } + accepted+="$commit $path"$'\n' + done <<< "$changed" + commit=$first + done + } + # The answer of only_merges_base, worked out once per run for the same approved commit, head and base + # branch, such as for two approvals given to the same commit. + declare -A answers=() reasons=() resolutions=() + checked_merges() { + local key="$1 $2 $3" + if [[ -z "${answers[$key]+set}" ]]; then + only_merges_base "$@" < /dev/null + answers[$key]=$? reasons[$key]=$reason resolutions[$key]=$accepted + fi + reason=${reasons[$key]} accepted=${resolutions[$key]} + return "${answers[$key]}" + } + # A conflict resolution that keeps an approval was not reviewed, so the pull request says which files each + # merge resolved, once for each merge: every comment of this workflow names its merges in a hidden marker, + # and the markers are read once per pull request and run, before the first comment. + declare -A noted=() + note_resolutions() { + local number=$1 merges merge sha path files body + [[ -n "$accepted" && "$DRY_RUN" != true ]] || return 0 + if [[ -z "${noted[$number]+set}" ]]; then + noted[$number]=$(timeout 60 gh api --paginate "repos/$REPO/issues/$number/comments" \ + --jq '.[] | select(.user.login == "github-actions[bot]") | .body | scan("") | .[0]') || { + unset "noted[$number]" + return 1 + } + fi + merges=$(cut -d ' ' -f 1 <<< "$accepted" | awk 'NF && !seen[$0]++' | grep -vxF -f <(printf '%s\n' "${noted[$number]}")) || return 0 + body="An approval of this pull request was kept across merges of the base branch whose conflicts were resolved by hand. Each resolution changes the files below only inside the conflicts git could not merge, and nobody has reviewed it yet."$'\n' + for merge in $merges; do + files= + while read -r sha path; do + [[ "$sha" == "$merge" ]] && files+="${files:+, }\`${path//\`/}\`" + done <<< "$accepted" + body+=$'\n'"- $merge: $files " + done + timeout 60 gh api "repos/$REPO/issues/$number/comments" -f body="$body" > /dev/null || return 1 + noted[$number]+=$'\n'"$merges" + } + git init --quiet --bare merges.git + # Every fetch adds a pack, and once there are enough of them git would start a gc in the background, which + # holds the lock of the shallow commits that the next fetch has to take, and that fetch would then fail. + git -C merges.git config gc.auto 0 + git -C merges.git config maintenance.auto false + git -C merges.git remote add origin "$GITHUB_SERVER_URL/$REPO" + git -C merges.git config "http.$GITHUB_SERVER_URL/.extraheader" "AUTHORIZATION: basic $(printf 'x-access-token:%s' "$GH_TOKEN" | base64 -w0)" # The approvals given to another commit than the head, of every open pull request or of the ones whose head # is the pushed commit. A review dismissed earlier is no longer an approval. GitHub has already moved an # approval to the head when the push left the diff of the pull request as it was, so an approval still at - # another commit was given to other changes. Nothing is compared here but the trees of the two commits: an - # approval is kept when its commit has the very tree of the head, which holds the content, the name and - # the mode of every file, and dismissed otherwise, also when either tree is unknown. One query serves a - # hundred pull requests, so that the hourly run does not spend a request of the token's rate limit on each. + # another commit was given to other changes. Only two of those are kept: an approval whose commit has the + # very tree of the head, which holds the content, the name and the mode of every file, and an approval + # that only merges of the base branch separate from the head (see only_merges_base). Every other one is + # dismissed, also when a tree is unknown. One query serves a hundred pull requests, so that the hourly run + # does not spend a request of the token's rate limit on each. gh api graphql --paginate -f owner="${REPO%/*}" -f name="${REPO#*/}" -f query=' query($owner: String!, $name: String!, $endCursor: String) { repository(owner: $owner, name: $name) { @@ -75,6 +268,7 @@ jobs: pageInfo { hasNextPage endCursor } nodes { number headRefOid + baseRef { target { oid } } commits(last: 1) { nodes { commit { oid tree { oid } } } } reviews(states: APPROVED, first: 100) { nodes { databaseId author { login } commit { oid tree { oid } } } } } @@ -84,15 +278,22 @@ jobs: | ([.commits.nodes[].commit | select(.oid == $pull.headRefOid) | .tree.oid][0] // "-") as $tree | .reviews.nodes[] | select(.commit.oid != $pull.headRefOid) | [$pull.number, $pull.headRefOid, .databaseId, .author.login // "ghost", .commit.oid // "-", - (if $tree != "-" and .commit.tree.oid == $tree then "same" else "changed" end)] | @tsv' > stale.tsv - while IFS=$'\t' read -r number head review login commit tree; do + (if $tree != "-" and .commit.tree.oid == $tree then "same" else "changed" end), + $pull.baseRef.target.oid // "-"] | @tsv' > stale.tsv + while IFS=$'\t' read -r number head review login commit tree base; do + reason="the pull request changed after this approval" accepted= if [[ "$tree" == same ]]; then echo "#$number: approval of $login at ${commit:0:10} kept, ${head:0:10} has the same files" + elif [[ "$commit" != - && "$base" != - ]] && checked_merges "$base" "$commit" "$head"; then + echo "#$number: approval of $login at ${commit:0:10} kept, ${head:0:10} only merges the base branch$( + awk 'NF { files[$1] = files[$1] sep[$1] $2; sep[$1] = ", "; if (!($1 in seen)) order[++n] = $1; seen[$1] } + END { for (i = 1; i <= n; i++) printf "%s %s resolved %s", (i == 1 ? ";" : ","), substr(order[i], 1, 10), files[order[i]] }' <<< "$accepted")" | tee -a "$GITHUB_STEP_SUMMARY" + note_resolutions "$number" || echo "::warning title=Resolution not noted::Could not comment on pull request #$number about the conflicts resolved after an approval" elif [[ "$DRY_RUN" == true ]]; then - echo "#$number: approval of $login at ${commit:0:10} would be dismissed, the head is ${head:0:10}" | tee -a "$GITHUB_STEP_SUMMARY" + echo "#$number: approval of $login at ${commit:0:10} would be dismissed, $reason, the head is ${head:0:10}" | tee -a "$GITHUB_STEP_SUMMARY" elif gh api -X PUT "repos/$REPO/pulls/$number/reviews/$review/dismissals" -f event=DISMISS \ - -f message="Dismissed automatically: the pull request changed after this approval, from ${commit:0:10} to ${head:0:10}." > /dev/null; then - echo "#$number: approval of $login at ${commit:0:10} dismissed, the head is ${head:0:10}" | tee -a "$GITHUB_STEP_SUMMARY" + -f message="Dismissed automatically: $reason, from ${commit:0:10} to ${head:0:10}." > /dev/null; then + echo "#$number: approval of $login at ${commit:0:10} dismissed, $reason, the head is ${head:0:10}" | tee -a "$GITHUB_STEP_SUMMARY" else # Another run may have dismissed it first, which is the outcome wanted anyway. echo "::warning title=Review not dismissed::Could not dismiss review $review of $login on pull request #$number" diff --git a/AGENTS.md b/AGENTS.md index 65fecd162ef..e23d35310af 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -255,7 +255,7 @@ GitHub-hosted runner time is shared with every other Apache project, so the work - A draft pull request runs nothing unless it carries the `run ci` label, and a pull request labelled `no ci` runs nothing at all: every workflow that reacts to a pull request skips all of its jobs, except `cancel-unneeded-pr-runs.yml`, described below. The Release Drafter (`release-notes.yml`) does not react to pull requests: the action it pins cannot label them, and it builds the draft from merged pull requests, so it runs on pushes to a release branch. Marking a draft ready for review starts CI (the workflows list the `ready_for_review` trigger type, which is not a default). Labels and the draft flag are read when a run starts, so set them before pushing; adding `run ci` or removing `no ci` takes effect on the next push, or when the draft is marked ready, while adding `no ci` cancels the runs in flight (see below). A push to a draft, or to a `no ci` pull request, still cancels the run in flight for that pull request, as every push to a pull request or a branch does through the concurrency groups of the test workflows; the run that replaces it does nothing. A new workflow with a `pull_request` trigger lists the same `types` as its siblings and gates its jobs the same way. - Merging a pull request, or labelling it `no ci`, cancels its runs in flight: `cancel-unneeded-pr-runs.yml` cancels the queued, pending and in-progress `pull_request` runs of every open pull request labelled `no ci`, and on a push to a release branch also those of each pull request the pushed commit merged that were created before the merge. A run is kept while an open pull request not labelled `no ci` has the same head commit, and the runs of a merged pull request labelled `run ci` are kept too: on a release branch below the default, the push after the merge builds without the tests, so the tests the label asked for on the pull request are the only ones the change gets there, and a late failure still calls for a follow-up fix. The workflow runs on every push to a release branch and when a pull request is labelled `no ci`, but a `pull_request` run from a fork gets a read-only token that cannot cancel runs, so labelling a fork's pull request skips the job, and that pull request's runs are cancelled by the next push to a release branch. For the same reason merges are found from the push rather than from the pull request being closed. It lists the unfinished `pull_request` runs of the repository once per sweep, not once per pull request, to spare the `GITHUB_TOKEN` rate limit. -- A push that changes a pull request dismisses the approvals given before it: `dismiss-stale-reviews.yml` dismisses every approval that was given to another commit than the head of the pull request. GitHub itself moves an approval to the new head after a push that leaves the diff of the pull request as it was, such as a rebase or a merge of the base branch, so those approvals are kept. The release branches do not require pull requests, so GitHub's own stale-review setting, which is part of that requirement, is not available. The workflow reacts to the Code Style workflow being requested for a pull request (`workflow_run`), not to the pull request, because a `pull_request` run from a fork gets a read-only token that cannot dismiss a review; it therefore runs from the default branch, also for a draft or a pull request labelled `no ci`, and it never checks out the pull request. Renaming the Code Style workflow, or dropping its `pull_request` trigger, stops it. The workflow compares no diff: an approval GitHub has not moved is dismissed unless its commit has the very tree of the head, so a push that only changes a space, moves an edit to another method, or changes the mode of a file dismisses it. GitHub starts no `pull_request` workflow for a commit whose message asks to skip them (`[skip ci]` and its variants) or for a pull request that conflicts with its base branch, so the workflow also looks at every open pull request once an hour (`schedule`); an approval can outlive such a push by at most that long. A manual run looks at every open pull request too and only reports, unless its `dry-run` input is cleared. +- A push that changes a pull request dismisses the approvals given before it: `dismiss-stale-reviews.yml` dismisses every approval that was given to another commit than the head of the pull request. GitHub itself moves an approval to the new head after a push that leaves the diff of the pull request as it was, such as a rebase or a merge of the base branch, so those approvals are kept. The release branches do not require pull requests, so GitHub's own stale-review setting, which is part of that requirement, is not available. The workflow reacts to the Code Style workflow being requested for a pull request (`workflow_run`), not to the pull request, because a `pull_request` run from a fork gets a read-only token that cannot dismiss a review; it therefore runs from the default branch, also for a draft or a pull request labelled `no ci`, and it never checks out the pull request. Renaming the Code Style workflow, or dropping its `pull_request` trigger, stops it. One approval GitHub has not moved is still kept: one that only update merges separate from the head. GitHub does not move an approval over a merge of the base branch that had conflicts, because resolving them changes the diff of the pull request, so the workflow repeats each merge (`git merge-tree` in a bare repository, on trees fetched without history; nothing of the pull request is checked out or run) and keeps the approval when every commit after the approved one has two parents, the second a commit of the base branch, and differs from the merge git makes by itself only inside the conflicts git could not merge: every file it changes is a conflicted one, with its mode and every line outside the conflict markers as git wrote them, and each conflict is resolved as a whole, the way git offers to: the pull request's side, the base branch's side, or both sides one after the other. A merge that changes any other line, that resolves a conflict any other way (a renumbered heading, lines picked from both sides, a line repeated or written by hand), that resolves by hand a conflict git writes without markers (a binary file, a file deleted on one side), that merges another branch, or that follows an ordinary commit pushed after the approval dismisses it. A kept approval and the files whose conflicts were resolved go to the step summary, and the pull request gets one comment per merge naming them, since nobody reviewed the resolution; the comment carries a hidden marker with the merge, so the hourly run does not repeat it. The walk over the merges goes back to the approved commit however many merges there are; only time bounds it, two minutes for one approval and seven for all of a run, so that the job always gets to the dismissals after it. A failed request is asked once more after a pause. A walk that runs out of time, or whose requests or git commands still fail, dismisses the approval with a message saying the commits could not be checked, not that the pull request changed; within a run its answer is reused for every approval given to the same commit. For any other push the workflow compares no diff: an approval GitHub has not moved is dismissed unless its commit has the very tree of the head, so a push that only changes a space, moves an edit to another method, or changes the mode of a file dismisses it. GitHub starts no `pull_request` workflow for a commit whose message asks to skip them (`[skip ci]` and its variants) or for a pull request that conflicts with its base branch, so the workflow also looks at every open pull request once an hour (`schedule`); an approval can outlive such a push by at most that long. A manual run looks at every open pull request too and only reports, unless its `dry-run` input is cleared. - Every workflow that runs tests calls `.github/workflows/ci-policy.yml` as its first job, `policy`, and gates its test jobs (and the test steps of its build jobs) on `needs.policy.outputs.run-tests`. Never test `github.event.head_commit.message` in a workflow: a `pull_request` payload has no such field, so that test silently ran the tests on every pull request. The policy reads the head commit of the push, of the pull request, or of the dispatched branch, and matches the marker against the start of the message's first line. The read is retried with a growing pause; when it still fails, the tests run, as they did before the policy existed, and a warning annotation and the step summary say so, so an API outage costs runner time rather than a test result. - The tests run by default only on the default branch and the release branches above it, and there a commit message starting with `[skip tests]` skips them. Everywhere else, that is on a release branch below the default (7.0.x, 7.1.x and 7.2.x while 8.0.x is the default) and on a pull request whose base is a side branch rather than a release branch, the tests run only on request: when the commit message starts with `[run tests]`, when the pull request carries the `run ci` label, or when a manual run (`workflow_dispatch`) in `apache/grails-core` has its `run-tests` input ticked. Otherwise the run builds, and on a push publishes snapshots, without tests, exactly like a `[skip tests]` commit; a `[skip tests]` commit also wins over the label and the input. The label is the way to test a backport pull request without rewriting its head commit, and the input is how the commit a release is cut from gets tested (see RELEASE.md); both are read when the run starts. A marker anywhere but at the start of the first line is ignored. The rule follows the default branch: when a new one is promoted, the branches below it stop running tests by default without an edit. The older release branches are kept quiet on purpose: a backport lands as one push to the oldest branch and a merge-up to each branch above it, and its tests belong on the pull request, labelled `run ci`, not on every push after it. Side branches are unreviewed development work (see the review process in CONTRIBUTING.md); their tests run when the branch is proposed to a release branch. In a fork, where the runner time is the fork owner's and not the ASF's, a manual run runs the tests unless the commit message starts with `[skip tests]`. - The jobs that run no tests (dependency validation, the build-without-tests steps, code style and build health) still run on every push to a release branch and on every non-draft pull request; RAT and CodeQL run on every push to a release branch and on every non-draft pull request into one, since their `pull_request` triggers list only release-branch bases. Only the `no ci` label, or a draft without `run ci`, stops them. The snapshot publish runs on every push to a release branch and on a manual run (the docs publish only on a push), never on a pull request. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ddef0359ace..065710ec610 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -315,8 +315,13 @@ Concerning when a review is required for a `protected` branch: An approval covers the changes that were reviewed. When a later push changes a pull request, the approvals given before it are dismissed automatically and the pull request has to be approved again; a rebase, or a merge of the base -branch, that leaves the changes of the pull request as they were keeps them. A dismissed approval does not block the -merge button, so check the review state of a pull request before merging it. +branch, that leaves the changes of the pull request as they were keeps them. A merge of the base branch that had +conflicts keeps them too, as long as each conflict is resolved by keeping one side, the other, or both one after the +other, and nothing outside the conflicts changes. Any other resolution, such as a renumbered heading, lines picked +from both sides or a line written by hand, dismisses them like any other change; made in a commit of its own after the +merge, it is at least easy to review again. +The pull request then gets a comment naming the files whose conflicts were resolved, for the reviewers to look at. A +dismissed approval does not block the merge button, so check the review state of a pull request before merging it. ## Join The Project Team For people willing to contribute more than an occasional pull request, consider joining our core team. Inquire in the `questions` channel in slack to learn more.