镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Make CONTRIBUTORS.txt optional in license headers - #268

Merged
FranzBusch merged 4 commits into
swiftlang:mainfrom
crleonard:licence-check-optional
Oct 9, 2026
Merged

FranzBusch merged 4 commits into
swiftlang:mainfrom
crleonard:licence-check-optional

Conversation

@crleonard

Copy link
Copy Markdown
Contributor

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

@FranzBusch FranzBusch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry this dropped in my queue. Getting around to this now. This seems sensible to me but I left a comment regarding the tests

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we configure the pull request CI to run these shell tests?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@FranzBusch I have added a shell_tests job, based on the similar template as other CI jobs in this repo.

@crleonard

Copy link
Copy Markdown
Contributor Author

@FranzBusch looks like CI is failing on an unrelated change.

@FranzBusch
FranzBusch merged commit a0e2672 into swiftlang:main Oct 9, 2026
195 of 196 checks passed
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