Skip to content

feat(dry-run): log commit contents#41718

Open
jamietanna wants to merge 4 commits intomainfrom
feat/commit-dry-run
Open

feat(dry-run): log commit contents#41718
jamietanna wants to merge 4 commits intomainfrom
feat/commit-dry-run

Conversation

@jamietanna
Copy link
Contributor

Changes

As a means to make the dry-run functionality a little more useful, we
can log out what commit(s) a given Renovate run would have created
outside of Dry Run.

Because the meta key contents is automagically replaced with
[contents], we need to move this into a new field, rawContents.

This can also lead to longer lines being output, but provides additional
utility that we've had requests for before.

Context

Please select one of the below:

  • This closes an existing Issue: Closes #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository:

 INFO: DRY-RUN: Would commit files to branch renovate/Makefile/github.com-golangci-golangci-lint-2.x (repository=oapi-codegen/oapi-codegen, baseBranch=main, branch=renovate/Makefile/github.com-golangci-golangci-lint-2.x)
       "branchName": "renovate/Makefile/github.com-golangci-golangci-lint-2.x",
       "files": [
         {
           "type": "addition",
           "path": "Makefile",
           "contents": "[content]",
           "rawContents": "GOBASE=$(shell pwd)\nGOBIN=$(GOBASE)/bin\n\nhelp:\n\t@echo \"This is a helper makefile for oapi-codegen\"\n\t@echo \"Targets:\"\n\t@echo \"    generate:    regenerate all generated files\"\n\t@echo
 \"    test:        run all tests\"\n\t@echo \"    tidy         tidy go mod\"\n\t@echo \"    lint         lint the project\"\n\n$(GOBIN)/golangci-lint:\n\tcurl -sSfL https://v-raw-githubusercontent-com.adclosenn.dev/golangci/golangci-lint/m
aster/install.sh | sh -s -- -b $(GOBIN) v2.11.1\n\n.PHONY: tools\ntools: $(GOBIN)/golangci-lint\n\nlint: tools\n\t# run the root module explicitly, to prevent recursive calls by re-invoking `make ...` top-level\n\t$(GOBIN)/g
olangci-lint run ./...\n\t# then, for all child modules, use a module-managed `Makefile`\n\tgit ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && env GOBIN=$(GOBIN) make lint'\n\nlint-ci: tools\n\t# for
 the root module, explicitly run the step, to prevent recursive calls\n\t$(GOBIN)/golangci-lint run ./... --output.text.path=stdout --timeout=5m\n\t# then, for all child modules, use a module-managed `Makefile`\n\tgit ls-fil
es '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && env GOBIN=$(GOBIN) make lint-ci'\n\ngenerate:\n\t# for the root module, explicitly run the step, to prevent recursive calls\n\tgo generate ./...\n\t# then, fo
r all child modules, use a module-managed `Makefile`\n\tgit ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && make generate'\n\ntest:\n\t# for the root module, explicitly run the step, to prevent recurs
ive calls\n\tgo test -cover ./...\n\t# then, for all child modules, use a module-managed `Makefile`\n\tgit ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && make test'\n\ntidy:\n\t# for the root module,
 explicitly run the step, to prevent recursive calls\n\tgo mod tidy\n\t# then, for all child modules, use a module-managed `Makefile`\n\tgit ls-files '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && make tidy'\
n\ntidy-ci:\n\t# for the root module, explicitly run the step, to prevent recursive calls\n\ttidied -verbose\n\t# then, for all child modules, use a module-managed `Makefile`\n\tgit ls-files '**/*go.mod' -z | xargs -0 -I{} b
ash -xc 'cd $$(dirname {}) && make tidy-ci'\n"
         }
       ],
       "message": "chore(deps): update module github.com/golangci/golangci-lint to v2.11.1 (makefile)",
       "force": true,
       "platformCommit": "auto",
       "prTitle": "chore(deps): update module github.com/golangci/golangci-lint to v2.11.1 (makefile)",
       "autoApprove": false,
       "labels": ["dependencies"]

As a means to make the dry-run functionality a little more useful, we
can log out what commit(s) a given Renovate run would have created
outside of Dry Run.

Because the meta key `contents` is automagically replaced with
`[contents]`, we need to move this into a new field, `rawContents`.

This can also lead to longer lines being output, but provides additional
utility that we've had requests for before.
@github-actions github-actions bot requested a review from viceice March 6, 2026 16:16
for (const file of logExtra.files) {
if (file.type === 'addition') {
// NOTE that we're rewriring this field so we get the raw contents logged, otherwise it'll be logged as `[content]`
(file as any).rawContents = file.contents;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure this can not be used to log secrets like .npmrc files? I'm a little worried about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did give it a test with process.env.RENOVATE_TOKEN, and I found that it was still redacted

AFAIK, any fields being logged out are still sanitised for secrets

@jamietanna jamietanna requested a review from secustor March 9, 2026 10:22
secustor
secustor previously approved these changes Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants