Skip to content

Commit acf30f2

Browse files
committed
ci: update WorkFlow
1 parent 44c1b6d commit acf30f2

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

.github/workflows/gradle-publish.yml

+32-4
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,41 @@ jobs:
2727
- name: Build Plugin with Gradle
2828
run: ./gradlew buildPlugin
2929

30+
- name: Get Previous Tag
31+
id: previous_tag
32+
uses: actions/github-script@v6
33+
with:
34+
script: |
35+
const { data: tags } = await github.rest.repos.listTags({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
per_page: 2,
39+
});
40+
if (tags.length < 2) {
41+
core.setFailed("Not enough tags to generate release notes.");
42+
} else {
43+
core.setOutput("previous_tag", tags[1].name);
44+
}
45+
3046
- name: Generate Release Notes
3147
id: generate_notes
32-
uses: actions/generate-release-notes@v2
48+
uses: actions/github-script@v6
3349
with:
34-
owner: ${{ github.repository_owner }}
35-
repo: ${{ github.event.repository.name }}
36-
tag_name: ${{ github.event.release.tag_name }}
50+
script: |
51+
const previousTag = "${{ steps.previous_tag.outputs.previous_tag }}";
52+
const currentTag = "${{ github.event.release.tag_name }}";
53+
const { data: commits } = await github.rest.repos.compareCommits({
54+
owner: context.repo.owner,
55+
repo: context.repo.repo,
56+
base: previousTag,
57+
head: currentTag,
58+
});
59+
60+
let releaseNotes = '### Changelog\n\n';
61+
commits.commits.forEach(commit => {
62+
releaseNotes += `- ${commit.commit.message}\n`;
63+
});
64+
core.setOutput("notes", releaseNotes);
3765
3866
- name: Update Release with Notes
3967
uses: actions/github-script@v6

0 commit comments

Comments
 (0)