Skip to content
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions license-header-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ inputs:
description: "excluded file pattern"
required: false
type: string
check_main:
description: "check main branch or not"
required: false
type: boolean
default: false

runs:
using: "composite"
Expand All @@ -36,10 +41,14 @@ runs:
CURRENT_YEAR=$(date +%Y)
LICENSE_PATTERN="Copyright \(c\) .*?${CURRENT_YEAR},? NVIDIA CORPORATION."

# Skip for merge to main PR
if [[ "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
echo "Skip this check for Merge to main PR."
exit 0
# Skip check for main branch when check_main == false
if [[ "${{ inputs.check_main }}" == "false" ]]; then
if [[ "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
echo "Skip this check for Merge to main PR."
exit 0
fi
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

[nitpick] The nested if blocks around check_main can be simplified into a single conditional to improve readability, for example: if [[ "${{ inputs.check_main }}" == "false" && "${{ github.event.pull_request.base.ref }}" == "main" ]]; then ... fi.

Suggested change
if [[ "${{ inputs.check_main }}" == "false" ]]; then
if [[ "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
echo "Skip this check for Merge to main PR."
exit 0
fi
if [[ "${{ inputs.check_main }}" == "false" && "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
echo "Skip this check for Merge to main PR."
exit 0
fi

Copilot uses AI. Check for mistakes.
else
echo "Will check main branch."
fi

# Format file patterns
Expand Down