GITHUB action - sonar scanner unable to detect pull request branch

I am trying to activate a sonar scan via github action,
and when I get pull request for my project,
It fails with a weird error message:

Run sonarsource/sonarcloud-github-action@master
/usr/bin/docker run --name c044289e0ded665be440aa14b3c636625c226_5d025c --label 6c0442 --workdir /github/workspace --rm -e “GITHUB_TOKEN” -e “SONAR_TOKEN” -e “SONAR_PULLREQUEST_KEY” -e “SONAR_PULLREQUEST_BRANCH” -e “SONAR_PULLREQUEST_BASE” -e “INPUT_ARGS” -e “INPUT_PROJECTBASEDIR” -e “HOME” -e “GITHUB_JOB” -e “GITHUB_REF” -e “GITHUB_SHA” -e “GITHUB_REPOSITORY” -e “GITHUB_REPOSITORY_OWNER” -e “GITHUB_REPOSITORY_OWNER_ID” -e “GITHUB_RUN_ID” -e “GITHUB_RUN_NUMBER” -e “GITHUB_RETENTION_DAYS” -e “GITHUB_RUN_ATTEMPT” -e “GITHUB_REPOSITORY_ID” -e “GITHUB_ACTOR_ID” -e “GITHUB_ACTOR” -e “GITHUB_TRIGGERING_ACTOR” -e “GITHUB_WORKFLOW” -e “GITHUB_HEAD_REF” -e “GITHUB_BASE_REF” -e “GITHUB_EVENT_NAME” -e “GITHUB_SERVER_URL” -e “GITHUB_API_URL” -e “GITHUB_GRAPHQL_URL” -e “GITHUB_REF_NAME” -e “GITHUB_REF_PROTECTED” -e “GITHUB_REF_TYPE” -e “GITHUB_WORKFLOW_REF” -e “GITHUB_WORKFLOW_SHA” -e “GITHUB_WORKSPACE” -e “GITHUB_ACTION” -e “GITHUB_EVENT_PATH” -e “GITHUB_ACTION_REPOSITORY” -e “GITHUB_ACTION_REF” -e “GITHUB_PATH” -e “GITHUB_ENV” -e “GITHUB_STEP_SUMMARY” -e “GITHUB_STATE” -e “GITHUB_OUTPUT” -e “RUNNER_OS” -e “RUNNER_ARCH” -e “RUNNER_NAME” -e “RUNNER_TOOL_CACHE” -e “RUNNER_TEMP” -e “RUNNER_WORKSPACE” -e “ACTIONS_RUNTIME_URL” -e “ACTIONS_RUNTIME_TOKEN” -e “ACTIONS_CACHE_URL” -e GITHUB_ACTIONS=true -e CI=true -v “/var/run/docker.sock”:“/var/run/docker.sock” -v “/home/runner/work/_temp/_github_home”:“/github/home” -v “/home/runner/work/_temp/_github_workflow”:“/github/workflow” -v “/home/runner/work/_temp/_runner_file_commands”:“/github/file_commands” -v “/home/runner/work/moodle-41-petel/moodle-41-petel”:“/github/workspace” 6c0442:89e0ded665be440aa14b3c636625c226
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /github/workspace/sonar-project.properties
INFO: SonarScanner 4.8.0.2856
INFO: Java 11.0.18 Alpine (64-bit)
INFO: Linux 5.15.0-1035-azure amd64
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Analyzing on SonarCloud
INFO: Default locale: “en_US”, source code encoding: “UTF-8” (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=682ms
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=649ms
INFO: Load/download plugins (done) | time=28955ms
INFO: Loaded core extensions: developer-scanner
INFO: Found an active CI vendor: ‘Github Actions’
INFO: Load project settings for component key: ‘
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=2ms
INFO: Project key: ***
INFO: Base dir: /github/workspace
INFO: Working dir: /github/workspace/.scannerwork
INFO: Load project branches
INFO: Load project branches (done) | time=625ms
INFO: Check ALM binding of project '

INFO: Detected project binding: NONEXISTENT
INFO: Check ALM binding of project ‘***’ (done) | time=624ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=635ms
INFO: Load branch configuration
INFO: Github event: pull_request
INFO: Auto-configuring pull request 1
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 40.044s
ERROR: Error during SonarScanner execution
ERROR: Could not find a default branch to fall back on.
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
INFO: Final Memory: 20M/70M
INFO: ------------------------------------------------------------------------

And here is part of the gha yaml file:

      - name: SonarCloud Scan
        uses: sonarsource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          SONAR_PULLREQUEST_KEY: ${{ github.event.pull_request.number }}
          SONAR_PULLREQUEST_BRANCH: ${{ github.head_ref }}
          SONAR_PULLREQUEST_BASE: ${{ github.base_ref }}

Hey there.

Does the project already exist in SonarCloud? This error tends to pop up when the first analysis of a project (that hasn’t been provisioned in SonarCloud) is of a short-lived branch or pull request.