PR comment shows empty "before" for modified values

Open
#1,110 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
devops

Research direction

Start in lib/mergeDeep.js, where compareDeep() records only the new value for a modified scalar, then in the before lookup in lib/settings.js that the PR comment renderer uses. Reproduce with a dry run where a repo's visibility is removed from its settings file, and confirm the comment shows an empty before. Done means the comment shows the current live value (for example private) for modified scalars, and the same holds for default_branch, delete_branch_on_merge, and team permissions.

Written by the indexing model from the issue text.

Description

Version: 3.0.0

In the dry-run PR comment, every modified value shows an empty before, even when the live value exists.

Example: a repo is visibility: private on GitHub. Deleting its repo file reverts it to the org default internal. The comment shows:

~ `visibility`
  - before: ``
  - after: `internal`

The same happens for default_branch, delete_branch_on_merge, and team permission changes.

Cause: MergeDeep.compareDeep() stores only the new value for a modified scalar (modifications[key] = sourceValue, lib/mergeDeep.js). The renderer in lib/settings.js takes before from a matching deletion entry, which doesn't exist for modified values.

Expected: before shows the current value on GitHub, for example private.

Dominant language
JavaScript
Stars
942
Forks
238
PR merge metrics
No merged PRs in 30d

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github-community-projects/safe-settings

All issues in github-community-projects/safe-settings

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.