Skip to content

Make CONTRIBUTORS.txt optional in license headers#268

Open
crleonard wants to merge 2 commits intoswiftlang:mainfrom
crleonard:licence-check-optional
Open

Make CONTRIBUTORS.txt optional in license headers#268
crleonard wants to merge 2 commits intoswiftlang:mainfrom
crleonard:licence-check-optional

Conversation

@crleonard
Copy link
Copy Markdown

Summary

#267

Update the shared license header check so source headers can omit the
CONTRIBUTORS.txt line.

Some Swift repositories have removed CONTRIBUTORS.txt, so requiring this line
in every source header leaves stale references behind. The check now continues
to accept existing headers that include the line, but also accepts headers where
the line has been removed.

Details

The checker still validates the full expected header first. If that comparison
fails, it retries after removing any CONTRIBUTORS.txt line from both the
expected header and the file header.

This keeps compatibility for repositories that still include the line while
allowing repositories that have removed CONTRIBUTORS.txt to update their
headers.

Testing

Added tests/check-license-header.sh, which creates a temporary git repo with
two Swift files:

  • one header with the CONTRIBUTORS.txt line
  • one header without the CONTRIBUTORS.txt line

Both are checked using the real license header script.

Manually verified with:

tests/check-license-header.sh
shellcheck tests/check-license-header.sh .github/workflows/scripts/check-license-header.sh
PROJECT_NAME=Swift.org .github/workflows/scripts/check-license-header.sh

@crleonard crleonard requested a review from a team as a code owner April 28, 2026 17:21
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.

1 participant