Skip to content

Commit

Permalink
move validation step to a job at the top of workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
LillieEntur committed Jan 16, 2025
1 parent 046277f commit 15711cb
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/code-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ env:
GITHUB_REPOSITORY: ${{ github.repository }}

jobs:
input_validation:
runs-on: ubuntu-24.04
steps:
- name: "Validate input CodeQL queries"
env:
CODEQL_QUERIES: ${{ inputs.codeql_queries }}
run: |
'if test -z "$CODEQL_QUERIES"
then
echo "Invalid configuration. codeql_queries is set to empty string. Use a comma-separated list: default, security-extended"
echo '## Code Scan - Invalid configuration
codeql_queries is set to empty string.
Use a comma-separated list as example: default, security-extended' >> $GITHUB_STEP_SUMMARY
exit 1
fi'
upload-scan-reports-from-matching-pr:
runs-on: ubuntu-24.04
outputs:
Expand Down Expand Up @@ -353,19 +368,6 @@ jobs:
cache-read-only: true # Force read only, even in main
add-job-summary: 'on-failure'

- name: "Validate input CodeQL queries"
env:
CODEQL_QUERIES: ${{ inputs.codeql_queries }}
run: |
'if test -z "$CODEQL_QUERIES"
then
echo "Invalid configuration. codeql_queries is set to empty string. Use a comma-separated list: default, security-extended"
echo '## Code Scan - Invalid configuration
codeql_queries is set to empty string.
Use a comma-separated list as example: default, security-extended' >> $GITHUB_STEP_SUMMARY
exit 1
fi'
- name: "Initialize CodeQL for Java/Kotlin"
if: matrix.language == 'kotlin' || matrix.language == 'java'
uses: github/codeql-action/init@v3
Expand Down

0 comments on commit 15711cb

Please sign in to comment.