Skip to content

Commit 3de663c

Browse files
authored
Dependency Updater: fix commit description formatting (base#520)
* fix commit description formatting * test new formatting * retrigger workflow run * test if title was properly set * test desc with quotes * remove newline chars * parenthesis fix * add quotes to view commit desc * remove newline
1 parent d96045b commit 3de663c

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

.github/workflows/update-dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ jobs:
3535
with:
3636
title: ${{ steps.run_dependency_updater.outputs.TITLE }}
3737
commit-message: ${{ steps.run_dependency_updater.outputs.TITLE }}
38-
body: ${{ steps.run_dependency_updater.outputs.DESC }}
38+
body: "${{ steps.run_dependency_updater.outputs.DESC }}"
3939
branch: run-dependency-updater
4040
delete-branch: true

dependency_updater/dependency_updater.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,11 @@ func createCommitMessage(updatedDependencies []VersionUpdateInfo, repoPath strin
141141
commitDescription += repo + " => " + tag + " (" + dependency.DiffUrl + ") "
142142
repos = append(repos, repo)
143143
}
144-
commitDescription = strings.TrimSuffix(commitDescription, "\n")
144+
commitDescription = strings.TrimSuffix(commitDescription, " ")
145145
commitTitle += strings.Join(repos, ", ")
146146

147147
if githubAction {
148-
commitDescription = "\"" + commitDescription + "\""
149-
err := createGitMessageEnv(commitTitle, commitDescription, repoPath)
148+
err := writeToGithubOutput(commitTitle, commitDescription, repoPath)
150149
if err != nil {
151150
return fmt.Errorf("error creating git commit message: %s", err)
152151
}
@@ -340,7 +339,7 @@ func createVersionsEnv(repoPath string, dependencies Dependencies) error {
340339
return nil
341340
}
342341

343-
func createGitMessageEnv(title string, description string, repoPath string) error {
342+
func writeToGithubOutput(title string, description string, repoPath string) error {
344343
file := os.Getenv("GITHUB_OUTPUT")
345344
f, err := os.OpenFile(file, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
346345
if err != nil {

0 commit comments

Comments
 (0)