GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Runs a standalone action along with a configured one · Issue #552 · github/codeql-action

Runs a standalone action along with a configured one #552

New issue
Copy link
New issue
Copy link
Open
Open
Runs a standalone action along with a configured one#552
Copy link

Description

@akshatgarg12
akshatgarg12
opened on Jun 7, 2021
Issue body actions

I have a PR-workflow file in my .github/workflow
Whenever a PR is created, a CodeQL action is being run from this config but an additional standalone CodeQL action is also created which fails with a warning

name: PR Workflow
on:
  pull_request:
    branches:
      - '**'

jobs:
  # few other actions here
  CodeQL:
    name: Analyse code with codeQL
    runs-on: ubuntu-latest
    needs: Continuous-Integration
    strategy:
      fail-fast: false
      matrix:
        language: [ 'javascript' ]
    steps:
       - name: Checkout repository
         uses: actions/checkout@v2

       - name: Initialize CodeQL
         uses: github/codeql-action/init@v1
         with:
          languages: ${{ matrix.language }}

       - name: Autobuild
         uses: github/codeql-action/autobuild@v1

       - name: Perform CodeQL Analysis
         uses: github/codeql-action/analyze@v1
       

Error
Screenshot 2021-06-07 at 11 45 45 PM
Workflow example
Screenshot 2021-06-06 at 11 04 20 PM

What changes do i need to make , to stop the last action from running which remains unresolved with the above warning?

Activity

  1. adityasharad commented on Jun 7, 2021

    @adityasharad
    adityasharad
    on Jun 7, 2021
    Contributor
    More actions

    The check status labelled Code scanning results / CodeQL is not a second Actions run, but is created by the GitHub code scanning service whenever it processes an analysis for your PR. This is by design: it contains a summary of the code scanning alerts for the PR. See https://docs.github.com/en/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/triaging-code-scanning-alerts-in-pull-requests for more information.

    By default this check status is informational and non-blocking, unless there are error-severity alerts and you've created branch protection rules that require the check. (The severity threshold is customisable, according to the docs linked above).

  2. adityasharad commented on Jun 7, 2021

    @adityasharad
    adityasharad
    on Jun 7, 2021
    Contributor
    More actions

    The warning about the base branch not being found is because your CodeQL analysis workflow has not run on the target branch of the PR (in this case, develop), so Code Scanning cannot perform a comparison to find out which alerts were fixed/introduced by the PR. Again this is not blocking, but if you set up the same workflow to run on your develop branch, then that should make the warning go away.

    For example:

    on:
      push:
        branches:
          - develop
      pull_request:
        branches:
          - develop
  3. akshatgarg12 commented on Jun 8, 2021

    @akshatgarg12
    akshatgarg12
    on Jun 8, 2021
    Author
    More actions

    @adityasharad Hey , thanks for the help man.
    Is there a way to run the CodeQL analysis on the target branch of the PR in all cases.
    Like here i have specified it to run on all branches at the top level of my yaml file

    on:
      pull_request:
        branches:
          - '**'
  4. adityasharad commented on Jun 9, 2021

    @adityasharad
    adityasharad
    on Jun 9, 2021
    Contributor
    More actions

    Depends what you are trying to achieve. Do you have PRs against all possible branches of your project? And are your PRs usually from branches of the same repository, or from forks?

    Could you narrow down the set of likely PR target branches? Then you could try something like:

    on:
      push:
        branches:
          - main
          - other-possible-target-branch
          - ...
      pull_request:
        branches:
          - main
          - other-possible-target-branch
          - ...   

    For completeness, I should point out that you can technically do the following to run on every single push and PR from/to any branch, but personally I wouldn't recommend it. Using pull_request events rather than push events for PR branches allows the PR merge commit to be analysed (rather than the base branch) and enables Code Scanning to compute an accurate comparison of the alerts fixed/introduced.

    # Possible but not recommended
    on:
      push:
        branches:
          - '**'
          - ...
      pull_request:
        branches:
          - '**'   
  5. adityasharad commented on Jun 9, 2021

    @adityasharad
    adityasharad
    on Jun 9, 2021
    Contributor
    More actions

    You can also do:

    on:
      push:
        branches:
          - main
          - other-possible-target-branch
          - ... # more branches here, but not all branches
      pull_request:  # no branches filter

    This will analyse any PR. But you'll get the best results, without the "analysis not found" warning you asked about earlier, for the PRs whose base branch is analysed by the push events. Hope this helps!

  6. akshatgarg12 commented on Jun 9, 2021

    @akshatgarg12
    akshatgarg12
    on Jun 9, 2021
    Author
    More actions

    Thanks this was really helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.