Skip to content

Commit b818803

Browse files
akurtakovCopilot
andcommitted
Generate license summary even without a GitLab token
Dependabot and fork pull requests don't have access to the GITLAB_API_TOKEN secret. Passing an empty token to dash-licenses made it consume the package-lock.json path as the token value, producing a usage error and no review summary. Only pass -review/-project/-token when a token is present. Without a token the tool still runs and writes the summary of unvetted dependencies, which the reporting step then comments on the PR and fails the run for. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1ce6627 commit b818803

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/licensecheck.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,12 @@ jobs:
111111
npmArgs=" --no-bin-links --ignore-scripts"
112112
dashArgs="-excludeSources local -summary $savePWD/target/dash/npm-review-summary"
113113
exitStatus=0
114-
if [ ${{ env.request-review }} ]; then
115-
# Add "-project <Project Name> -token <Token>" here when a review is required
116-
dashArgs="$dashArgs -review -project $projectId -token $gitlabAPIToken"
114+
if [ -n "$gitlabAPIToken" ]; then
115+
# A GitLab token is available (e.g. on branches/PRs that can access
116+
# repository secrets), so request a review automatically. Dependabot
117+
# and fork pull requests don't get the secret; in that case we skip
118+
# the review request and still produce the summary of unvetted deps.
119+
dashArgs="$dashArgs -review -project $projectId -token $gitlabAPIToken"
117120
fi
118121
#
119122
# Check NPM dependency licenses in main WildWebDeveloper project

0 commit comments

Comments
 (0)