Skip to content

Commit b33cf2b

Browse files
committed
ci: adjust again the workflow for sending emails
The workflow doesn't know what are the new commits in the target branch. It does now which PR has been merged, but it only has the original revisions, before the merge queue rebased them... So instead of looking at the target branch, craft the emails from the original commits. Signed-off-by: Marc Poulhiès <[email protected]>
1 parent ef5dd50 commit b33cf2b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/send-emails.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ jobs:
7070
REPO_SSH=$(jq -r '.repository.ssh_url' /tmp/gh_event.json)
7171
echo "REPO_SSH=$REPO_SSH" >> $GITHUB_ENV
7272
73+
echo "GH_TOKEN=${{ github.token }}" >> $GITHUB_ENV
74+
7375
echo "SERIES_DIR=/tmp/series" >> $GITHUB_ENV
7476
7577
- name: Check for label 'no-ml' to skip sending emails
@@ -97,8 +99,12 @@ jobs:
9799
regex=$(printf '%s\n' "${patterns[@]}" | sed -e 's/[.[\*^$+?(){|\/\\]/\\&/g' | paste -sd'|' -)
98100
99101
rm -f /tmp/commits.txt
100-
git log --reverse --format="%H" "$PR_BASE_REF..HEAD" | while read SHA1; do
101-
if grep -q -E "$regex" <(git diff-tree --no-commit-id --name-only -r "$SHA1"); then
102+
103+
# Fetch commits from the pull request (maybe they're from another repository)
104+
git fetch origin "pull/$PR_NUMBER/head"
105+
106+
gh api repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/commits --jq '.[].sha' | while read SHA1; do
107+
if grep -q -E "$regex" <(git diff-tree --no-commit-id --name-only -r "$SHA1"); then
102108
echo "Touching something not to be upstreamed, skipping commit $SHA1"
103109
else
104110
echo "$SHA1" >> /tmp/commits.txt

0 commit comments

Comments
 (0)