Skip to content

Commit e57b225

Browse files
authored
ci: automatically tag contributors in GitHub release notes (#10074)
* squash * fail with message if unable to fetch contributors * add comment about permissions
1 parent 7a7011b commit e57b225

1 file changed

Lines changed: 34 additions & 6 deletions

File tree

.github/workflows/github_release.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
- "v2.[0-9]+.[0-9]+*"
88
# Ignore release versions tagged with -rc0 suffix
99
- "!v2.[0-9]+.[0-9]-rc0"
10-
1110
jobs:
1211
generate-notes:
1312
runs-on: ubuntu-latest
@@ -59,16 +58,45 @@ jobs:
5958
reno report --no-show-source --ignore-cache --version v${{ steps.version.outputs.current_release }} -o relnotes.rst
6059
6160
- name: Convert to Markdown
62-
uses: docker://pandoc/core:3.1
61+
uses: docker://pandoc/core:3.8
6362
with:
64-
args: "--from rst --to markdown_github --no-highlight relnotes.rst -o relnotes.md --wrap=none"
63+
args: "--from rst --to gfm --syntax-highlighting=none --wrap=none relnotes.rst -o relnotes.md"
64+
65+
# We copy the relnotes file since the original one cannot be modified due to permissions
66+
- name: Copy relnotes file
67+
run: |
68+
cat relnotes.md > enhanced_relnotes.md
69+
70+
- name: Add contributor list
71+
# only for minor releases and minor release candidates (not bugfix releases)
72+
if: endsWith(steps.version.outputs.current_release, '.0')
73+
env:
74+
GH_TOKEN: ${{ github.token }}
75+
START: v${{ steps.version.outputs.current_release }}-rc0
76+
END: ${{ github.ref_name }}
77+
run: |
78+
JQ_EXPR='[.commits[].author.login]
79+
| map(select(. != null and . != "HaystackBot" and . != "dependabot[bot]"))
80+
| unique
81+
| sort_by(ascii_downcase)
82+
| map("@\(.)")
83+
| join(", ")'
84+
CONTRIBUTORS=$(gh api "repos/deepset-ai/haystack/compare/$START...$END" \
85+
--jq "$JQ_EXPR") || { echo "Unable to fetch contributors"; exit 1; }
86+
87+
{
88+
echo ""
89+
echo "## 💙 Big thank you to everyone who contributed to this release!"
90+
echo ""
91+
echo "$CONTRIBUTORS"
92+
} >> enhanced_relnotes.md
6593
6694
- name: Debug
6795
run: |
68-
cat relnotes.md
96+
cat enhanced_relnotes.md
6997
7098
- uses: ncipollo/release-action@v1
7199
with:
72-
bodyFile: "relnotes.md"
73-
prerelease: ${{ steps.version.outputs.current_pre_release }}
100+
bodyFile: "enhanced_relnotes.md"
101+
prerelease: ${{ steps.version.outputs.current_pre_release != '' }}
74102
allowUpdates: true

0 commit comments

Comments
 (0)