Skip to content

Commit

Permalink
build: Incorrect change logs are auto-generated in release prs (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-todorov authored Jul 9, 2023
1 parent fc7d1ac commit 7b45fa2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bump-snapshot-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
author: "cs-devops-bot <[email protected]>"
commit-message: "chore(snapshot): Prepare for v${{ inputs.VERSION }}\n Release-As: ${{ inputs.VERSION }}"
commit-message: "chore(snapshot): Prepare for v${{ inputs.VERSION }}\n\nRelease-As: ${{ inputs.VERSION }}"
title: "chore(snapshot): Prepare for v${{ inputs.VERSION }}"
body: ""
labels: automated pr
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/command-dispatcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ jobs:
"permission": "write",
"issue_type": "pull-request"
},
{
"command": "update-release",
"permission": "write",
"issue_type": "pull-request"
},
{
"command": "deploy-pr",
"permission": "write",
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/command-help.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ jobs:
> --- | ---
> /merge-snapshot | Squash and merge snapshot PR.
> /merge-release | Squash and merge release PR.
> /update-release | Updates the changelog of a release PR.
> /deploy-pr | Deploys the PR as a snapshot version (i.e. `org.carlspring.cloud.aws:s3fs-nio:PR-${{ github.event.client_payload.github.payload.issue.number }}-SNAPSHOT` using ref `${{ github.event.client_payload.pull_request.head.sha }}`)
reaction-type: hooray
2 changes: 1 addition & 1 deletion .github/workflows/command-merge-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
const isRelease = prTitle.includes("Release v")
if(!isRelease) {
console.log("")
console.error("/merge-snapshot is supposed to be executed only on pull requests updating the version to snapshot!")
console.error("/merge-release is supposed to be executed only on pull requests updating the version to a release!")
console.log("")
process.exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/command-merge-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
const commit_raw_title = split[0];
const commit_title = commit_raw_title + " (#${{ github.event.client_payload.github.payload.issue.number }})"
split.shift()
let commit_message = (split.join('\n') + "\n\nCo-authored-by: " + commits[0].author.name + " <" + commits[0].author.email + ">").trim();
let commit_message = (split.join('\n') + "\nCo-authored-by: " + commits[0].author.name + " <" + commits[0].author.email + ">").trim();
console.log("Squash title: " + commit_title);
console.log("Squash message: \n" + commit_message + "\n/Squash message\n");
await github.rest.pulls.merge({
Expand Down
23 changes: 17 additions & 6 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
on:
workflow_dispatch:
workflow_call:
repository_dispatch:
types: [ update-release-command ]

permissions:
contents: write
Expand All @@ -10,12 +12,21 @@ name: Prepare release

jobs:
prepare-release:
if: |
${{ github.repository == vars.CURRENT_REPO }} &&
${{ (github.triggering_actor == 'carlspring' || github.triggering_actor == 'steve-todorov') == true }}
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
id: release
- uses: actions/checkout@v3
with:
# https://github.com/googleapis/release-please/blob/main/src/changelog-notes.ts#L42
command: manifest
# This is required to avoid `release-please failed: API rate limit exceeded for installation ID XYZ`
token: ${{ secrets.GITHUB_TOKEN }}
ref: 'master'
fetch-depth: 1

- uses: actions/setup-node@v3

- name: Install release-please
run: npm install -g release-please

- name: Release
run: |
release-please --token=${{ secrets.GITHUB_TOKEN }} --repo-url=${{ vars.CURRENT_REPO }} release-pr --release-type simple --pull-request-title-pattern "Release v\${version}" --extra-files gradle.properties,docs/mkdocs.yaml,docs/mkdocs.yml

0 comments on commit 7b45fa2

Please sign in to comment.