From 485b7d63af51c051d8ce6424b8a7b0651778a771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Tue, 23 Sep 2025 21:34:44 +0200 Subject: [PATCH 1/5] ci: Don't bother trying to link original PR And put the commit link in every mail. --- .github/workflows/send-emails.yml | 51 ++++++++++++++++++------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/.github/workflows/send-emails.yml b/.github/workflows/send-emails.yml index 769e24858b6..8dcd464ced1 100644 --- a/.github/workflows/send-emails.yml +++ b/.github/workflows/send-emails.yml @@ -97,8 +97,7 @@ jobs: regex=$(printf '%s\n' "${patterns[@]}" | sed -e 's/[.[\*^$+?(){|\/\\]/\\&/g' | paste -sd'|' -) rm -f /tmp/commits.txt - - git log --format="%H" "$PR_BASE_REF..HEAD" | while read SHA1; do + git log --reverse --format="%H" "$PR_BASE_REF..HEAD" | while read SHA1; do if grep -q -E "$regex" <(git diff-tree --no-commit-id --name-only -r "$SHA1"); then echo "Touching something not to be upstreamed, skipping commit $SHA1" else @@ -115,13 +114,9 @@ jobs: if [ "${COUNT}" -gt "$MAX" ]; then echo "Series has $COUNT commits (> $MAX). Not doing anything" >> $GITHUB_STEP_SUMMARY exit 0 - else if [ "${COUNT}" -eq 1 ]; then - echo "Single commit PR, don't do the cover letter" - echo "DO_COVER=0" >> $GITHUB_ENV - else - echo "Multiple commits ($COUNT) in PR, create a cover letter" - echo "DO_COVER=1" >> $GITHUB_ENV - fi fi + fi + + echo "DO_COVER=0" >> $GITHUB_ENV - name: Prepare patch series run: | @@ -138,18 +133,11 @@ jobs: N="${COUNT:-0}" TITLE="$(printf '[PATCH 0/%d] PR #%s: %s' "$N" "$PR_NUMBER" "$PR_TITLE")" - echo "PR: $PR_URL" > /tmp/description.txt - echo "Merged by: ${{ github.actor }}" >> /tmp/description.txt - echo "Base: $PR_TARGET_BRANCH" >> /tmp/description.txt - echo "" >> /tmp/description.txt - echo "This series was merged into the gccrs repository and is posted here for" >> /tmp/description.txt + echo "This change was merged into the gccrs repository and is posted here for" >> /tmp/description.txt echo "upstream visibility and potential drive-by review, as requested by GCC" >> /tmp/description.txt echo "release managers." >> /tmp/description.txt - echo "" >> /tmp/description.txt - echo " Notes:" >> /tmp/description.txt - echo " - Source branch: $(jq -r '.pull_request.head.label' /tmp/gh_event.json)" >> /tmp/description.txt - echo " - Merge commit: $PR_MERGE_COMMIT" >> /tmp/description.txt - echo " - Commit count: $N" >> /tmp/description.txt + echo "Each commit email contains a link to its details on github from where you can" >> /tmp/description.txt + echo "find the Pull-Request and associated discussions." >> /tmp/description.txt echo "" >> /tmp/description.txt mkdir /tmp/series @@ -175,8 +163,29 @@ jobs: --output-directory /tmp/series \ "$PR_BASE_REF"..HEAD - # for every patch file, insert the github header right after the '---'. - sed '/^---$/ r /tmp/description.txt' -i /tmp/series/* + echo "" >> /tmp/description.txt + + cp /tmp/commits.txt /tmp/commits_stack.txt + while IFS= read -r -d '' f;do + # Read next SHA1... + SHA1=$(head -n1 /tmp/commits_stack.txt) + + # ... and pop it from the stack + sed -i '1d' /tmp/commits_stack.txt + + echo "SHA1: $SHA1" + echo "patch file: $f" + echo "" + + cp /tmp/description.txt "/tmp/tmp_descr.txt" + echo "Commit on github: https://github.com/rust-GCC/gccrs/commit/$SHA1" >> "/tmp/tmp_descr.txt" + + # insert the github header right after the '---'. + sed '/^---$/ r /tmp/tmp_descr.txt' -i "$f" + + # loop over the patches and make sure to do that in numerical order + # 0001-..., 0002-...., ... + done < <(find /tmp/series/ -maxdepth 1 -type f -print0|sort -z -n) fi - name: Send series via git send-email From 3bd90a6b7088679504875b4dd2c03f694013ddc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Tue, 23 Sep 2025 21:37:53 +0200 Subject: [PATCH 2/5] ci: for testing --- .github/workflows/send-emails.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/send-emails.yml b/.github/workflows/send-emails.yml index 8dcd464ced1..7554725b690 100644 --- a/.github/workflows/send-emails.yml +++ b/.github/workflows/send-emails.yml @@ -5,7 +5,7 @@ on: types: - closed branches: - - "master" + - "test" jobs: send_patches: From 26492d064a964aee75f7e46078887d1b47a7b7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Tue, 23 Sep 2025 21:35:50 +0200 Subject: [PATCH 3/5] oldest --- a | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 a diff --git a/a b/a new file mode 100644 index 00000000000..e69de29bb2d From 582af5313e89fcdc77ad1e5bdf4d51b246ea73d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Tue, 23 Sep 2025 21:35:58 +0200 Subject: [PATCH 4/5] middle --- b | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 b diff --git a/b b/b new file mode 100644 index 00000000000..e69de29bb2d From fb9cfeab9e9494de5d67e976146bae95b02593c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Tue, 23 Sep 2025 21:36:05 +0200 Subject: [PATCH 5/5] newest --- c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 c diff --git a/c b/c new file mode 100644 index 00000000000..e69de29bb2d