From 8d53acbbb26928da60b215c71de90293ec70fbe6 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Mon, 14 Aug 2023 04:28:03 -0300 Subject: ci: move codeql python job into its own workflow Only run the CodeQL Python analysis if a .py file is changed. --- .github/workflows/check-python.yml | 53 +++++++++++++++++++++++++++++++++++ .github/workflows/codeql-analysis.yml | 12 +------- 2 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/check-python.yml diff --git a/.github/workflows/check-python.yml b/.github/workflows/check-python.yml new file mode 100644 index 000000000..91b87650f --- /dev/null +++ b/.github/workflows/check-python.yml @@ -0,0 +1,53 @@ +name: Check-Python + +on: + push: + paths: + - '**.py' + - .github/workflows/check-python.yml + pull_request: + paths: + - '**.py' + - .github/workflows/check-python.yml + schedule: + - cron: '0 7 * * 2' + +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + +jobs: + codeql-python: + permissions: + actions: read + contents: read + security-events: write + runs-on: ubuntu-latest + + steps: + - name: Harden Runner + uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 + with: + disable-sudo: true + egress-policy: block + allowed-endpoints: > + api.github.com:443 + files.pythonhosted.org:443 + github.com:443 + objects.githubusercontent.com:443 + pypi.org:443 + uploads.github.com:443 + + - name: Checkout repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + + - name: print env + run: ./ci/printenv.sh + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@0ba4244466797eb048eb91a6cd43d5c03ca8bd05 + with: + languages: python + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@0ba4244466797eb048eb91a6cd43d5c03ca8bd05 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bb43f7d50..c16fd732c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -44,14 +44,6 @@ jobs: name: Analyze runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - language: [ 'cpp', 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - steps: - name: Harden Runner uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 @@ -60,10 +52,8 @@ jobs: egress-policy: block allowed-endpoints: > api.github.com:443 - files.pythonhosted.org:443 github.com:443 objects.githubusercontent.com:443 - pypi.org:443 uploads.github.com:443 - name: Checkout repository @@ -76,7 +66,7 @@ jobs: - name: Initialize CodeQL uses: github/codeql-action/init@5b6282e01c62d02e720b81eb8a51204f527c3624 with: - languages: ${{ matrix.language }} + languages: cpp # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) -- cgit v1.2.3-70-g09d2