Skip to content

Commit

Permalink
fix: revert release changes (#32)
Browse files Browse the repository at this point in the history
<!--
Thank you for proposing a pull request! Please note that SOME TESTS WILL
LIKELY FAIL due to how GitHub exposes secrets in Pull Requests from
forks.
Someone from the team will review your Pull Request and respond.

Please describe your change and any implementation details below.
-->
  • Loading branch information
verbanicm authored Oct 23, 2024
1 parent 2706386 commit 7db31c4
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: 'Release'

on:
workflow_call:
secrets:
ACTIONS_BOT_TOKEN:
required: true

jobs:
release:
Expand All @@ -20,7 +17,6 @@ jobs:
- name: 'Get previous release tag'
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' # ratchet:actions/github-script@v7
with:
github-token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
script: |-
try {
const latestRelease = await github.rest.repos.getLatestRelease({
Expand All @@ -36,35 +32,11 @@ jobs:
}
}
- name: 'Generate release notes'
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' # ratchet:actions/github-script@v7
with:
script: |-
const tag = "v" + process.env.NEW_VERSION;
try {
if (process.env.PREV_TAG) {
const releaseNotes = await github.rest.repos.generateReleaseNotes({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tag,
target_commitish: context.sha,
previous_tag_name: process.env.PREV_TAG,
});
core.exportVariable("RELEASE_NOTES", releaseNotes.data.body)
}
} catch (err) {
core.setFailed(`Failed to generate release notes: ${err}`);
}
- name: 'Create release'
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' # ratchet:actions/github-script@v7
with:
github-token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
script: |-
const tag = "v" + process.env.NEW_VERSION;
const releaseNotes = process.env.RELEASE_NOTES;
try {
const createReleaseRequest = {
Expand All @@ -76,8 +48,16 @@ jobs:
generate_release_notes: true,
};
if (releaseNotes.length) {
createReleaseRequest.body = releaseNotes;
if (process.env.PREV_TAG) {
const releaseNotes = await github.rest.repos.generateReleaseNotes({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tag,
target_commitish: context.sha,
previous_tag_name: process.env.PREV_TAG,
});
createReleaseRequest.body = releaseNotes.data.body;
createReleaseRequest.generate_release_notes = false;
}
Expand Down

0 comments on commit 7db31c4

Please sign in to comment.