Skip to content

Prevent spurious PRs from key-order-only changes in settings.json#179

Merged
rajbos merged 2 commits into
mainfrom
copilot/add-check-to-lint-update-workflow
Mar 29, 2026
Merged

Prevent spurious PRs from key-order-only changes in settings.json#179
rajbos merged 2 commits into
mainfrom
copilot/add-check-to-lint-update-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 29, 2026

PowerShell's unordered @{} hashtable serializes keys alphabetically, causing settings.json to appear changed on every run (key reordering only, no version change) and triggering unnecessary PRs.

Changes

  • Value-based comparison instead of file diff — reads current settings.json and compares actionlintversion and actionlintversiontag values directly against the fetched ones; exits early if identical
  • [ordered]@{} — uses an ordered hashtable when writing settings.json to keep key order stable across runs, eliminating future reorder-only diffs
# Before: always wrote the file first, then checked git diff
# → key reordering triggered a "change" every run

# After: compare values first, skip entirely if unchanged
$currentSettings = Get-Content -Path settings.json | ConvertFrom-Json
if ($currentSettings.actionlintversiontag -eq $latest -and $currentSettings.actionlintversion -eq $digest) {
    echo "settings.json values have not changed, no need to create a PR"
    exit 0
}

# Only reached when version actually changed; write with stable key order
$settings = [ordered]@{
    actionlintversion    = $digest
    actionlintversiontag = $latest
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add check to prevent redundant PRs from lint update Prevent spurious PRs from key-order-only changes in settings.json Mar 29, 2026
Copilot AI requested a review from rajbos March 29, 2026 02:06
@rajbos rajbos marked this pull request as ready for review March 29, 2026 02:33
@github-actions
Copy link
Copy Markdown
Contributor

Tagging @rajbos for notifications

@github-actions
Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA af07336.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@rajbos rajbos merged commit 56ca104 into main Mar 29, 2026
14 checks passed
@rajbos rajbos deleted the copilot/add-check-to-lint-update-workflow branch March 29, 2026 02:33
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.

2 participants