From b8d5b80a5779b4726880e3bd0f503deca6396bf0 Mon Sep 17 00:00:00 2001 From: JenabaBa Date: Fri, 1 Aug 2025 09:00:13 -0700 Subject: [PATCH 1/9] fix commit description formatting --- dependency_updater/dependency_updater.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dependency_updater/dependency_updater.go b/dependency_updater/dependency_updater.go index 34cfbf2ba..2e6307e46 100644 --- a/dependency_updater/dependency_updater.go +++ b/dependency_updater/dependency_updater.go @@ -134,18 +134,17 @@ func updater(token string, repoPath string, commit bool, githubAction bool) erro func createCommitMessage(updatedDependencies []VersionUpdateInfo, repoPath string, githubAction bool) error { var repos []string commitTitle := "chore: updated " - commitDescription := "Updated dependencies for: " + commitDescription := "Updated dependencies for: \n" for _, dependency := range updatedDependencies { repo, tag := dependency.Repo, dependency.To - commitDescription += repo + " => " + tag + " (" + dependency.DiffUrl + ") " + commitDescription += repo + " => " + tag + " (" + dependency.DiffUrl + ")\n" repos = append(repos, repo) } commitDescription = strings.TrimSuffix(commitDescription, "\n") commitTitle += strings.Join(repos, ", ") if githubAction { - commitDescription = "\"" + commitDescription + "\"" err := createGitMessageEnv(commitTitle, commitDescription, repoPath) if err != nil { return fmt.Errorf("error creating git commit message: %s", err) From 006a1376521f4776b8e65758df4c5b024de4de73 Mon Sep 17 00:00:00 2001 From: JenabaBa Date: Mon, 4 Aug 2025 09:06:43 -0700 Subject: [PATCH 2/9] test new formatting --- .github/workflows/update-dependencies.yml | 26 ++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 55d9a2af2..5bf8cd46a 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -1,8 +1,8 @@ name: Update Dockerfile Dependencies on: - schedule: - - cron: '0 13 * * *' - workflow_dispatch: + # schedule: + # - cron: '0 13 * * *' + pull_request: permissions: contents: write @@ -29,12 +29,14 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: cd dependency_updater && ./dependency_updater --repo ../ --github-action true - - name: create pull request - if: ${{ steps.run_dependency_updater.outputs.TITLE != '' }} - uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 - with: - title: ${{ steps.run_dependency_updater.outputs.TITLE }} - commit-message: ${{ steps.run_dependency_updater.outputs.TITLE }} - body: ${{ steps.run_dependency_updater.outputs.DESC }} - branch: run-dependency-updater - delete-branch: true \ No newline at end of file + - name: test new formatting + run: echo ${{ steps.run_dependency_updater.outputs.DESC }} + # - name: create pull request + # if: ${{ steps.run_dependency_updater.outputs.TITLE != '' }} + # uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 + # with: + # title: ${{ steps.run_dependency_updater.outputs.TITLE }} + # commit-message: ${{ steps.run_dependency_updater.outputs.TITLE }} + # body: ${{ steps.run_dependency_updater.outputs.DESC }} + # branch: run-dependency-updater + # delete-branch: true \ No newline at end of file From 026a24e1ffc1c557b532b6273352a51e250b6d22 Mon Sep 17 00:00:00 2001 From: JenabaBa Date: Mon, 4 Aug 2025 09:09:59 -0700 Subject: [PATCH 3/9] retrigger workflow run --- .github/workflows/update-dependencies.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 5bf8cd46a..d21ba1a58 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -31,6 +31,7 @@ jobs: - name: test new formatting run: echo ${{ steps.run_dependency_updater.outputs.DESC }} + # - name: create pull request # if: ${{ steps.run_dependency_updater.outputs.TITLE != '' }} # uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 From 6f4adbab2144068924d2ca3707df2d04d303be1c Mon Sep 17 00:00:00 2001 From: JenabaBa Date: Mon, 4 Aug 2025 09:17:17 -0700 Subject: [PATCH 4/9] test if title was properly set --- .github/workflows/update-dependencies.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index d21ba1a58..b4e88ddf7 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -30,8 +30,8 @@ jobs: run: cd dependency_updater && ./dependency_updater --repo ../ --github-action true - name: test new formatting - run: echo ${{ steps.run_dependency_updater.outputs.DESC }} - + run: echo ${{ steps.run_dependency_updater.outputs.TITLE }} + # - name: create pull request # if: ${{ steps.run_dependency_updater.outputs.TITLE != '' }} # uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 From bd68407db019ab23cce2ced4067ebedfab58f51f Mon Sep 17 00:00:00 2001 From: JenabaBa Date: Mon, 4 Aug 2025 09:19:23 -0700 Subject: [PATCH 5/9] test desc with quotes --- .github/workflows/update-dependencies.yml | 2 +- dependency_updater/dependency_updater.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index b4e88ddf7..67ade006b 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -30,7 +30,7 @@ jobs: run: cd dependency_updater && ./dependency_updater --repo ../ --github-action true - name: test new formatting - run: echo ${{ steps.run_dependency_updater.outputs.TITLE }} + run: echo ${{ steps.run_dependency_updater.outputs.DESC }} # - name: create pull request # if: ${{ steps.run_dependency_updater.outputs.TITLE != '' }} diff --git a/dependency_updater/dependency_updater.go b/dependency_updater/dependency_updater.go index 2e6307e46..7b7caec59 100644 --- a/dependency_updater/dependency_updater.go +++ b/dependency_updater/dependency_updater.go @@ -145,6 +145,7 @@ func createCommitMessage(updatedDependencies []VersionUpdateInfo, repoPath strin commitTitle += strings.Join(repos, ", ") if githubAction { + commitDescription = "\"" + commitDescription + "\"" err := createGitMessageEnv(commitTitle, commitDescription, repoPath) if err != nil { return fmt.Errorf("error creating git commit message: %s", err) From 640e31a7e0a139d5490c59fd97318a5521131e1a Mon Sep 17 00:00:00 2001 From: JenabaBa Date: Mon, 4 Aug 2025 09:20:47 -0700 Subject: [PATCH 6/9] remove newline chars --- dependency_updater/dependency_updater.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dependency_updater/dependency_updater.go b/dependency_updater/dependency_updater.go index 7b7caec59..ac9d45e65 100644 --- a/dependency_updater/dependency_updater.go +++ b/dependency_updater/dependency_updater.go @@ -134,18 +134,17 @@ func updater(token string, repoPath string, commit bool, githubAction bool) erro func createCommitMessage(updatedDependencies []VersionUpdateInfo, repoPath string, githubAction bool) error { var repos []string commitTitle := "chore: updated " - commitDescription := "Updated dependencies for: \n" + commitDescription := "Updated dependencies for: " for _, dependency := range updatedDependencies { repo, tag := dependency.Repo, dependency.To - commitDescription += repo + " => " + tag + " (" + dependency.DiffUrl + ")\n" + commitDescription += repo + " => " + tag + " (" + dependency.DiffUrl + ") " repos = append(repos, repo) } - commitDescription = strings.TrimSuffix(commitDescription, "\n") + commitDescription = strings.TrimSuffix(commitDescription, " ") commitTitle += strings.Join(repos, ", ") if githubAction { - commitDescription = "\"" + commitDescription + "\"" err := createGitMessageEnv(commitTitle, commitDescription, repoPath) if err != nil { return fmt.Errorf("error creating git commit message: %s", err) From 16c8d7aa6e61068175a7524a3c90bb65acb45372 Mon Sep 17 00:00:00 2001 From: JenabaBa Date: Mon, 4 Aug 2025 09:24:10 -0700 Subject: [PATCH 7/9] parenthesis fix --- dependency_updater/dependency_updater.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependency_updater/dependency_updater.go b/dependency_updater/dependency_updater.go index ac9d45e65..5d7833bc8 100644 --- a/dependency_updater/dependency_updater.go +++ b/dependency_updater/dependency_updater.go @@ -138,7 +138,7 @@ func createCommitMessage(updatedDependencies []VersionUpdateInfo, repoPath strin for _, dependency := range updatedDependencies { repo, tag := dependency.Repo, dependency.To - commitDescription += repo + " => " + tag + " (" + dependency.DiffUrl + ") " + commitDescription += repo + " => " + tag + " \\\\(" + dependency.DiffUrl + "\\\\) " repos = append(repos, repo) } commitDescription = strings.TrimSuffix(commitDescription, " ") From 29492c20436fbec0386aa2fac585ced0bf5cbc7a Mon Sep 17 00:00:00 2001 From: JenabaBa Date: Mon, 4 Aug 2025 09:26:40 -0700 Subject: [PATCH 8/9] add quotes to view commit desc --- .github/workflows/update-dependencies.yml | 2 +- dependency_updater/dependency_updater.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 67ade006b..f01e94299 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -30,7 +30,7 @@ jobs: run: cd dependency_updater && ./dependency_updater --repo ../ --github-action true - name: test new formatting - run: echo ${{ steps.run_dependency_updater.outputs.DESC }} + run: echo "${{ steps.run_dependency_updater.outputs.DESC }}" # - name: create pull request # if: ${{ steps.run_dependency_updater.outputs.TITLE != '' }} diff --git a/dependency_updater/dependency_updater.go b/dependency_updater/dependency_updater.go index 5d7833bc8..2e6307e46 100644 --- a/dependency_updater/dependency_updater.go +++ b/dependency_updater/dependency_updater.go @@ -134,14 +134,14 @@ func updater(token string, repoPath string, commit bool, githubAction bool) erro func createCommitMessage(updatedDependencies []VersionUpdateInfo, repoPath string, githubAction bool) error { var repos []string commitTitle := "chore: updated " - commitDescription := "Updated dependencies for: " + commitDescription := "Updated dependencies for: \n" for _, dependency := range updatedDependencies { repo, tag := dependency.Repo, dependency.To - commitDescription += repo + " => " + tag + " \\\\(" + dependency.DiffUrl + "\\\\) " + commitDescription += repo + " => " + tag + " (" + dependency.DiffUrl + ")\n" repos = append(repos, repo) } - commitDescription = strings.TrimSuffix(commitDescription, " ") + commitDescription = strings.TrimSuffix(commitDescription, "\n") commitTitle += strings.Join(repos, ", ") if githubAction { From 10624bf3c04eb8fc52260adf0952aa208891cccf Mon Sep 17 00:00:00 2001 From: JenabaBa Date: Mon, 4 Aug 2025 09:32:42 -0700 Subject: [PATCH 9/9] remove newline --- .github/workflows/update-dependencies.yml | 27 ++++++++++------------- dependency_updater/dependency_updater.go | 10 ++++----- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index f01e94299..3ce14cff3 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -1,8 +1,8 @@ name: Update Dockerfile Dependencies on: - # schedule: - # - cron: '0 13 * * *' - pull_request: + schedule: + - cron: '0 13 * * *' + workflow_dispatch: permissions: contents: write @@ -29,15 +29,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: cd dependency_updater && ./dependency_updater --repo ../ --github-action true - - name: test new formatting - run: echo "${{ steps.run_dependency_updater.outputs.DESC }}" - - # - name: create pull request - # if: ${{ steps.run_dependency_updater.outputs.TITLE != '' }} - # uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 - # with: - # title: ${{ steps.run_dependency_updater.outputs.TITLE }} - # commit-message: ${{ steps.run_dependency_updater.outputs.TITLE }} - # body: ${{ steps.run_dependency_updater.outputs.DESC }} - # branch: run-dependency-updater - # delete-branch: true \ No newline at end of file + - name: create pull request + if: ${{ steps.run_dependency_updater.outputs.TITLE != '' }} + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 + with: + title: ${{ steps.run_dependency_updater.outputs.TITLE }} + commit-message: ${{ steps.run_dependency_updater.outputs.TITLE }} + body: "${{ steps.run_dependency_updater.outputs.DESC }}" + branch: run-dependency-updater + delete-branch: true \ No newline at end of file diff --git a/dependency_updater/dependency_updater.go b/dependency_updater/dependency_updater.go index 2e6307e46..fe87c9dd6 100644 --- a/dependency_updater/dependency_updater.go +++ b/dependency_updater/dependency_updater.go @@ -134,18 +134,18 @@ func updater(token string, repoPath string, commit bool, githubAction bool) erro func createCommitMessage(updatedDependencies []VersionUpdateInfo, repoPath string, githubAction bool) error { var repos []string commitTitle := "chore: updated " - commitDescription := "Updated dependencies for: \n" + commitDescription := "Updated dependencies for: " for _, dependency := range updatedDependencies { repo, tag := dependency.Repo, dependency.To - commitDescription += repo + " => " + tag + " (" + dependency.DiffUrl + ")\n" + commitDescription += repo + " => " + tag + " (" + dependency.DiffUrl + ") " repos = append(repos, repo) } - commitDescription = strings.TrimSuffix(commitDescription, "\n") + commitDescription = strings.TrimSuffix(commitDescription, " ") commitTitle += strings.Join(repos, ", ") if githubAction { - err := createGitMessageEnv(commitTitle, commitDescription, repoPath) + err := writeToGithubOutput(commitTitle, commitDescription, repoPath) if err != nil { return fmt.Errorf("error creating git commit message: %s", err) } @@ -339,7 +339,7 @@ func createVersionsEnv(repoPath string, dependencies Dependencies) error { return nil } -func createGitMessageEnv(title string, description string, repoPath string) error { +func writeToGithubOutput(title string, description string, repoPath string) error { file := os.Getenv("GITHUB_OUTPUT") f, err := os.OpenFile(file, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil {