Skip to content

Conversation

@elrayle
Copy link
Collaborator

@elrayle elrayle commented Jan 13, 2026

Context

Fixes #126

Changes

Updates the workflow that runs nightly to update licenses to compare changes to the PR's branch if it exists and the main branch if it doesn't. This should eliminate the noisy comments in the PR's timeline that happen daily once the PR is created. It is more meaningful to only see changes when there are new licenses. It provides information on how often the licenses are actually changing.

@elrayle elrayle requested a review from dangoor as a code owner January 13, 2026 21:00
Copilot AI review requested due to automatic review settings January 13, 2026 21:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the fetch-licenses workflow to compare changes against the PR branch (if it exists) instead of always comparing against the main branch. This prevents noisy daily updates to an existing PR when there are no actual license changes.

Changes:

  • Added a step to determine the baseline branch (auto-update-licenses if PR exists, otherwise main)
  • Updated git diff commands to compare against the determined baseline branch instead of the working directory
  • Fixed a debug output command to correctly display the current branch name
Comments suppressed due to low confidence (1)

.github/workflows/fetch-licenses.yaml:90

  • The git diff command is comparing against a remote branch reference (origin/auto-update-licenses or origin/main), but the workflow only performs a checkout without fetching the remote branch first. When actions/checkout@v6 runs, it only fetches the current branch by default. This means that origin/auto-update-licenses may not be available locally for the diff command to use, which could cause the diff to fail or behave unexpectedly. Consider adding a fetch step after determining the baseline branch, or ensure that the baseline branch is fetched before performing the diff operations.
                  git diff --quiet "$BASE_REF" -- spdxexp/spdxlicenses/*.go && genfiles_changed=false

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

echo "Update Licenses PR exists, so diff against its branch origin/auto-update-licenses."
base_ref="origin/auto-update-licenses"
else
echo "Update Licenses PR does NOT exists, so diff against branch origin/main"
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

There's a grammatical error in this echo message. The word "exists" should be singular here, not "does NOT exists". It should be "does NOT exist".

Suggested change
echo "Update Licenses PR does NOT exists, so diff against branch origin/main"
echo "Update Licenses PR does NOT exist, so diff against branch origin/main"

Copilot uses AI. Check for mistakes.
src_changed=true
# --quiet: Exits with 1 if there are changes; otherwise, exits with 0
git diff --quiet -- cmd/licenses.json cmd/exceptions.json && src_changed=false
git diff --quiet "$BASE_REF" -- cmd/licenses.json cmd/exceptions.json && src_changed=false
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The git diff command is comparing against a remote branch reference (origin/auto-update-licenses or origin/main), but the workflow only performs a checkout without fetching the remote branch first. When actions/checkout@v6 runs, it only fetches the current branch by default. This means that origin/auto-update-licenses may not be available locally for the diff command to use, which could cause the diff to fail or behave unexpectedly. Consider adding a fetch step after determining the baseline branch, or ensure that the baseline branch is fetched before performing the diff operations.

This issue also appears in the following locations of the same file:

  • line 90

Copilot uses AI. Check for mistakes.
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.

fix noisy update license PR

2 participants