99 - " strawberry/**"
1010 - " pyproject.toml"
1111
12+ permissions :
13+ pull-requests : write
14+
15+ env :
16+ AUTOPUB_CMD : uvx --from 'autopub>=1.0.0a48' --with pygithub autopub
17+
1218jobs :
1319 get-contributor-info :
1420 name : Get PR info
3844 id : skip
3945 shell : python
4046 run : |
47+ import os
4148 bots = [
4249 "dependabot-preview[bot]",
4350 "dependabot-preview",
4956
5057 if username in bots:
5158 print(f"Skipping {username} because it is a bot")
52- print("::set-output name=skip::true")
59+ with open(os.environ["GITHUB_OUTPUT"], "a") as f:
60+ f.write("skip=true\n")
5361 else:
54- print("::set-output name=skip::false")
62+ with open(os.environ["GITHUB_OUTPUT"], "a") as f:
63+ f.write("skip=false\n")
5564
5665 release-file-check :
5766 name : Release check
@@ -63,17 +72,58 @@ jobs:
6372 changelog : ${{ steps.release-check.outputs.changelog }}
6473 status : ${{ steps.release-check.outputs.release_status }}
6574 change_type : ${{ steps.release-check.outputs.change_type }}
75+ has_release : ${{ steps.check.outputs.has_release }}
6676
6777 steps :
6878 - name : Checkout code
69- uses : actions/checkout@v2
79+ uses : actions/checkout@v4
7080 with :
7181 ref : " refs/pull/${{ github.event.number }}/merge"
82+ sparse-checkout : |
83+ RELEASE.md
84+ pyproject.toml
85+ sparse-checkout-cone-mode : false
86+
87+ - name : Install uv
88+ uses : astral-sh/setup-uv@v5
89+
90+ - name : Check with autopub
91+ id : check
92+ run : |
93+ if $AUTOPUB_CMD check; then
94+ echo "has_release=true" >> $GITHUB_OUTPUT
95+ echo "release_status=OK" >> $GITHUB_OUTPUT
96+ else
97+ echo "has_release=false" >> $GITHUB_OUTPUT
98+ echo "release_status=MISSING" >> $GITHUB_OUTPUT
99+ fi
100+ env :
101+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
72102
73- - name : Release file check
74- uses : strawberry-graphql/strawberry/.github/release-check-action@main
103+ - name : Extract release info
75104 id : release-check
76- if : github.event.pull_request.draft == false
105+ if : steps.check.outputs.has_release == 'true' && github.event.pull_request.draft == false
106+ run : |
107+ # Read the RELEASE.md file to get changelog and change type
108+ if [ -f "RELEASE.md" ]; then
109+ # Extract change type from first line
110+ change_type=$(head -1 RELEASE.md | grep -oE "(major|minor|patch)" | head -1)
111+ echo "change_type=${change_type}" >> $GITHUB_OUTPUT
112+
113+ # Extract changelog (everything after first line)
114+ changelog=$(tail -n +2 RELEASE.md | base64 -w 0)
115+ echo "changelog=${changelog}" >> $GITHUB_OUTPUT
116+ echo "release_status=OK" >> $GITHUB_OUTPUT
117+ fi
118+
119+ - name : Upload .autopub artifact
120+ if : steps.check.outputs.has_release == 'true'
121+ uses : actions/upload-artifact@v4
122+ with :
123+ name : autopub-data
124+ path : .autopub
125+ include-hidden-files : true
126+ if-no-files-found : ignore
77127
78128 read-tweet-md :
79129 name : Read TWEET.md
84134 tweet : ${{ steps.extract.outputs.tweet }}
85135
86136 steps :
87- - uses : actions/checkout@v2
137+ - uses : actions/checkout@v4
88138 with :
89139 ref : " refs/pull/${{ github.event.number }}/merge"
90140 - name : Extract tweet message and changelog
@@ -112,7 +162,7 @@ jobs:
112162 if : github.event.pull_request.draft == false
113163
114164 steps :
115- - uses : actions/checkout@v2
165+ - uses : actions/checkout@v4
116166 - name : Send comment
117167 uses : ./.github/bot-action
118168 env :
0 commit comments