Skip to content

Default branch is null for event of type schedule #106

@Jolg42

Description

@Jolg42

The part of the code implicated might be
https://github.com/ossf/scorecard-action/blob/main/entrypoint.sh#L52

Action https://github.com/prisma/prisma/actions/runs/1849483308/workflow

name: Scorecards supply-chain security
on:
  # Only the default branch is supported.
  branch_protection_rule:
  schedule:
    - cron: '21 21 * * 2'
  push:
    branches: [main]

# Declare default permissions as read only.
permissions: read-all

jobs:
  analysis:
    name: Scorecards analysis
    runs-on: ubuntu-latest
    permissions:
      # Needed to upload the results to code-scanning dashboard.
      security-events: write
      actions: read
      contents: read

    steps:
      - name: 'Checkout code'
        uses: actions/checkout@v2
        with:
          persist-credentials: false

      - name: 'Run analysis'
        uses: ossf/[email protected]
        with:
          results_file: results.sarif
          results_format: sarif
          # Read-only PAT token. To create it,
          # follow the steps in https://github.com/ossf/scorecard-action#pat-token-creation.
          repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
          # Publish the results to enable scorecard badges. For more details, see
          # https://github.com/ossf/scorecard-action#publishing-results.
          # For private repositories, `publish_results` will automatically be set to `false`,
          # regardless of the value entered here.
          publish_results: true

      # Upload the results as artifacts (optional).
      - name: 'Upload artifact'
        uses: actions/[email protected]
        with:
          name: SARIF file
          path: results.sarif
          retention-days: 5

      # Upload the results to GitHub's code scanning dashboard.
      - name: 'Upload to code-scanning'
        uses: github/codeql-action/upload-sarif@v1
        with:
          sarif_file: results.sarif

...

Logs https://github.com/prisma/prisma/runs/5207383913?check_suite_focus=true#step:5:16

Event file: /github/workflow/event.json
Event name: schedule
Ref: refs/heads/main
Repository: null
Private repository: null
Publication enabled: true
Format: sarif
Policy file: /policy.yml
Default branch: refs/heads/null
refs/heads/main not supported with 'schedule' event.
Only the default branch 'refs/heads/null' is supported

This shows that the default branch is not detected (detected as null). It should have been detected as main

refs/heads/main not supported with 'schedule' event.
Only the default branch 'refs/heads/null' is supported

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions