diff --git a/.github/workflows/pull-request-labels.yml b/.github/workflows/add-pr-labels.yml similarity index 72% rename from .github/workflows/pull-request-labels.yml rename to .github/workflows/add-pr-labels.yml index 31e1bd9..e008a67 100644 --- a/.github/workflows/pull-request-labels.yml +++ b/.github/workflows/add-pr-labels.yml @@ -2,11 +2,7 @@ name: Add pull request labels on: - pull_request_target: - branches: - - current - - equuleus - - sagitta + workflow_call: jobs: add-pr-label: diff --git a/.github/workflows/auto-author-assign.yml b/.github/workflows/assign-author.yml similarity index 71% rename from .github/workflows/auto-author-assign.yml rename to .github/workflows/assign-author.yml index 0bfe972..bd9c7ee 100644 --- a/.github/workflows/auto-author-assign.yml +++ b/.github/workflows/assign-author.yml @@ -1,10 +1,6 @@ name: "PR Triage" on: - pull_request_target: - types: [opened, reopened, ready_for_review, locked] - -permissions: - pull-requests: write + workflow_call: jobs: # https://github.com/marketplace/actions/auto-author-assign diff --git a/.github/workflows/pr-conflicts.yml b/.github/workflows/check-pr-merge-conflict.yml similarity index 81% rename from .github/workflows/pr-conflicts.yml rename to .github/workflows/check-pr-merge-conflict.yml index 2fd0bb4..556fce2 100644 --- a/.github/workflows/pr-conflicts.yml +++ b/.github/workflows/check-pr-merge-conflict.yml @@ -1,12 +1,14 @@ -name: "PR Conflicts checker" +name: "Check PR merge conflicts" on: - pull_request_target: - types: [synchronize] + workflow_call: jobs: - Conflict_Check: + pr-conflict-Check: name: 'Check PR status: conflicts and resolution' runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - name: check if PRs are dirty uses: eps1lon/actions-label-merge-conflict@v3 diff --git a/.github/workflows/check-pr-message.yml b/.github/workflows/check-pr-message.yml new file mode 100644 index 0000000..e921239 --- /dev/null +++ b/.github/workflows/check-pr-message.yml @@ -0,0 +1,27 @@ +--- +name: Check pull request message format + +on: + workflow_call: + +jobs: + check-pr-title: + name: Check pull request title + runs-on: ubuntu-latest + steps: + - 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: | + ./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 95% rename from .github/workflows/stale.yml rename to .github/workflows/check-stale.yml index 4af1383..a71884c 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/check-stale.yml @@ -1,7 +1,7 @@ name: "Issue and PR stale management" + on: - schedule: - - cron: "0 0 * * *" + workflow_call: jobs: stale: diff --git a/.github/workflows/unused-imports.yml b/.github/workflows/check-unused-imports.yml similarity index 68% rename from .github/workflows/unused-imports.yml rename to .github/workflows/check-unused-imports.yml index da57bd2..2bddb48 100644 --- a/.github/workflows/unused-imports.yml +++ b/.github/workflows/check-unused-imports.yml @@ -1,22 +1,25 @@ name: Check for unused imports using Pylint + on: - pull_request_target: - branches: - - current - - sagitta + 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 diff --git a/.github/workflows/mergifyio_backport.yml b/.github/workflows/label-backport.yml similarity index 91% rename from .github/workflows/mergifyio_backport.yml rename to .github/workflows/label-backport.yml index 1ded8b5..c0c8947 100644 --- a/.github/workflows/mergifyio_backport.yml +++ b/.github/workflows/label-backport.yml @@ -1,6 +1,7 @@ -name: Mergifyio backport +name: Label backport -on: [issue_comment] +on: + workflow_call: jobs: mergifyio_backport: diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/lint-j2.yml similarity index 85% rename from .github/workflows/pull-request-management.yml rename to .github/workflows/lint-j2.yml index 34c9c45..4cefdd1 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/lint-j2.yml @@ -2,11 +2,7 @@ name: Build Pull Request Package on: - pull_request: - branches: - - current - - sagitta - - equuleus + workflow_call: jobs: j2lint: diff --git a/.github/workflows/pull-request-message-check.yml b/.github/workflows/pull-request-message-check.yml deleted file mode 100644 index 2487879..0000000 --- a/.github/workflows/pull-request-message-check.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Check pull request message format - -on: - pull_request: - branches: - - current - - sagitta - - equuleus - -jobs: - check-pr-title: - name: Check pull request title - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - timeout-minutes: 2 - - 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 }}'