Skip to content

Commit

Permalink
Fix nasa#264, CodeQL Dependent on Successful Build
Browse files Browse the repository at this point in the history
  • Loading branch information
arielswalker committed Jul 19, 2021
1 parent fb2968d commit b7415bb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-cfs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build, Test, and Run [OMIT_DEPRECATED=true]
name: Build, Test, and Run

# Run every time a new commit pushed or for pull requests
on:
Expand Down
45 changes: 18 additions & 27 deletions .github/workflows/codeql-build.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
name: "CodeQL Analysis"

# Only trigger, when the build workflow succeeded
on:
push:
pull_request:
branches:
- main

workflow_run:
workflows:
- Build, Test, and Run
types:
- completed
branches:
- '**'
env:
SIMULATION: native
ENABLE_UNIT_TESTS: true
OMIT_DEPRECATED: true
BUILDTYPE: release

jobs:
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
check-for-duplicates:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'


jobs:
CodeQL-Security-Build:
#Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
needs: check-for-duplicates
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-18.04
timeout-minutes: 15

Expand Down Expand Up @@ -75,9 +61,7 @@ jobs:
uses: github/codeql-action/analyze@v1

CodeQL-Coding-Standard-Build:
#Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
needs: check-for-duplicates
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-18.04
timeout-minutes: 15

Expand Down Expand Up @@ -127,3 +111,10 @@ jobs:
- name: Perform CodeQL Analysis
if: ${{ !steps.skip-workflow.outputs.skip }}
uses: github/codeql-action/analyze@v1

on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Fail workflow
run: exit 1

0 comments on commit b7415bb

Please sign in to comment.