Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add warning for empty repo token #71

Merged
merged 1 commit into from Feb 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions entrypoint.sh
Expand Up @@ -30,6 +30,7 @@ export SCORECARD_POLICY_FILE="/policy.yml" # Copied at docker image creation.
export SCORECARD_RESULTS_FILE="$INPUT_RESULTS_FILE"
export SCORECARD_RESULTS_FORMAT="$INPUT_RESULTS_FORMAT"
export SCORECARD_PUBLISH_RESULTS="$INPUT_PUBLISH_RESULTS"
export SCORECARD_IS_FORK="$(jq '.repository.fork' $GITHUB_EVENT_PATH)"
export SCORECARD_BIN="/scorecard"
export ENABLED_CHECKS=

Expand Down Expand Up @@ -66,12 +67,26 @@ echo "Event file: $GITHUB_EVENT_PATH"
echo "Event name: $GITHUB_EVENT_NAME"
echo "Ref: $GITHUB_REF"
echo "Repository: $GITHUB_REPOSITORY"
echo "Fork repository: $SCORECARD_IS_FORK"
echo "Private repository: $SCORECARD_PRIVATE_REPOSITORY"
echo "Publication enabled: $SCORECARD_PUBLISH_RESULTS"
echo "Format: $SCORECARD_RESULTS_FORMAT"
echo "Policy file: $SCORECARD_POLICY_FILE"
echo "Default branch: $SCORECARD_DEFAULT_BRANCH"

if [[ -z "$GITHUB_AUTH_TOKEN" ]]; then
echo "The 'repo_token' variable is empty."

if [[ "$SCORECARD_IS_FORK" == "true" ]]; then
echo "We have detected you are running on a fork."
fi

echo "Please follow the instructions at https://github.com/ossf/scorecard-action#authentication to create the read-only PAT token."
exit 1
fi



# Note: this will fail if we push to a branch on the same repo, so it will show as failing
# on forked repos.
if [[ "$GITHUB_EVENT_NAME" != "pull_request"* ]] && [[ "$GITHUB_REF" != "$SCORECARD_DEFAULT_BRANCH" ]]; then
Expand Down