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 #552DescriptionI 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

Workflow example

What changes do i need to make , to stop the last action from running which remains unresolved with the above warning? Activityadityasharad commented on Jun 7, 2021 adityasharad commented on Jun 7, 2021 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:
- developakshatgarg12 commented on Jun 8, 2021 @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:
- '**'adityasharad commented on Jun 9, 2021 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:
- '**' adityasharad commented on Jun 9, 2021 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! akshatgarg12 commented on Jun 9, 2021 Thanks this was really helpful.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|