diff --git a/.github/workflows/pull-request-message-check.yml b/.github/workflows/check-pr-message.yml similarity index 52% rename from .github/workflows/pull-request-message-check.yml rename to .github/workflows/check-pr-message.yml index f119fb8..e921239 100644 --- a/.github/workflows/pull-request-message-check.yml +++ b/.github/workflows/check-pr-message.yml @@ -9,11 +9,19 @@ jobs: name: Check pull request title runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 timeout-minutes: 2 + + - name: Checkout reusable actions repo + uses: actions/checkout@v3 + with: + repository: vyos/.github + path: reusable-actions + - name: Install the requests library run: pip3 install requests + - name: Check the PR title timeout-minutes: 2 run: | - ./scripts/check-pr-title-and-commit-messages.py '${{ github.event.pull_request.url }}' + ./reusable-actions/scripts/check-pr-title-and-commit-messages.py '${{ github.event.pull_request.url }}' diff --git a/.github/workflows/stale.yml b/.github/workflows/check-stale.yml similarity index 100% rename from .github/workflows/stale.yml rename to .github/workflows/check-stale.yml diff --git a/.github/workflows/unused-imports.yml b/.github/workflows/check-unused-imports.yml similarity index 71% rename from .github/workflows/unused-imports.yml rename to .github/workflows/check-unused-imports.yml index c2fb95c..2bddb48 100644 --- a/.github/workflows/unused-imports.yml +++ b/.github/workflows/check-unused-imports.yml @@ -4,17 +4,22 @@ on: workflow_call: jobs: - Check-Unused-Imports: + check-unused-imports: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - name: Set up Python uses: actions/setup-python@v3 with: python-version: 3.11 + - name: Install dependencies run: | python -m pip install --upgrade pip pip install pylint + - name: Analysing the code with pylint - run: make unused-imports + run: | + pylint_files=$(git ls-files *.py src/migration-scripts) + pylint --disable=all --enable=W0611 $(pylint_files) \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..7176702 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,61 @@ +# This workflow helps to analyze repository code for vulnerabilities, bugs, and other errors using CodeQL. +# For that CodeQL Action is used: https://github.com/github/codeql-action +# Learn more about CodeQL at https://codeql.github.com/ + +name: CodeQL + +on: + workflow_call: + inputs: + languages: + description: "Optional input to set languages for CodeQL check. Supported values are: 'cpp', 'csharp', 'go', 'java', 'javascript', 'typescript', 'python', 'ruby'. To set multiple languages, use the same syntax as you can see in the default value." + required: false + type: string + default: "['python']" + codeql-cfg-path: + description: "Optional input to set path to a CodeQL config file" + required: false + type: string + build-command: + description: "Optional input to specify manual build command. The multiline syntax is supported" + required: false + type: string + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ${{fromJson(inputs.languages)}} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{matrix.language}} + config-file: ${{inputs.codeql-cfg-path}} + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, configure a build command manually using build-command input. This command will be executed in the corresponding step. + - name: Autobuild + if: ${{!inputs.build-command}} + uses: github/codeql-action/autobuild@v3 + + - name: Manual build + if: ${{inputs.build-command}} + run: | + ${{inputs.build-command}} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3