Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6349: added reusable workflows #2

Merged
merged 7 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
name: Add pull request labels

on:
pull_request_target:
branches:
- current
- equuleus
- sagitta
workflow_call:

jobs:
add-pr-label:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/check-pr-message.yml
Original file line number Diff line number Diff line change
@@ -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 }}'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "Issue and PR stale management"

on:
schedule:
- cron: "0 0 * * *"
workflow_call:

jobs:
stale:
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
61 changes: 61 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Mergifyio backport
name: Label backport

on: [issue_comment]
on:
workflow_call:

jobs:
mergifyio_backport:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
name: Build Pull Request Package

on:
pull_request:
branches:
- current
- sagitta
- equuleus
workflow_call:

jobs:
j2lint:
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/pull-request-message-check.yml

This file was deleted.