Skip to content

Commit 6f36cfa

Browse files
authored
T6349: added reusable workflows (#2)
* T6349: added reusable workflows * T6349: added reusable pr merge conflict check workflows * T6349: added reusable pr merge conflict check workflows * T6349: added reusable pr merge conflict check workflows * T6349: added reusable check workflows * T6349: added reusable check workflows * T6349: added reusable check workflows
1 parent 1e62015 commit 6f36cfa

10 files changed

+111
-52
lines changed

.github/workflows/pull-request-labels.yml renamed to .github/workflows/add-pr-labels.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
name: Add pull request labels
33

44
on:
5-
pull_request_target:
6-
branches:
7-
- current
8-
- equuleus
9-
- sagitta
5+
workflow_call:
106

117
jobs:
128
add-pr-label:

.github/workflows/auto-author-assign.yml renamed to .github/workflows/assign-author.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: "PR Triage"
22
on:
3-
pull_request_target:
4-
types: [opened, reopened, ready_for_review, locked]
5-
6-
permissions:
7-
pull-requests: write
3+
workflow_call:
84

95
jobs:
106
# https://github.com/marketplace/actions/auto-author-assign

.github/workflows/pr-conflicts.yml renamed to .github/workflows/check-pr-merge-conflict.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
name: "PR Conflicts checker"
1+
name: "Check PR merge conflicts"
22
on:
3-
pull_request_target:
4-
types: [synchronize]
3+
workflow_call:
54

65
jobs:
7-
Conflict_Check:
6+
pr-conflict-Check:
87
name: 'Check PR status: conflicts and resolution'
98
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
pull-requests: write
1012
steps:
1113
- name: check if PRs are dirty
1214
uses: eps1lon/actions-label-merge-conflict@v3
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Check pull request message format
3+
4+
on:
5+
workflow_call:
6+
7+
jobs:
8+
check-pr-title:
9+
name: Check pull request title
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
timeout-minutes: 2
14+
15+
- name: Checkout reusable actions repo
16+
uses: actions/checkout@v3
17+
with:
18+
repository: vyos/.github
19+
path: reusable-actions
20+
21+
- name: Install the requests library
22+
run: pip3 install requests
23+
24+
- name: Check the PR title
25+
timeout-minutes: 2
26+
run: |
27+
./reusable-actions/scripts/check-pr-title-and-commit-messages.py '${{ github.event.pull_request.url }}'

.github/workflows/stale.yml renamed to .github/workflows/check-stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "Issue and PR stale management"
2+
23
on:
3-
schedule:
4-
- cron: "0 0 * * *"
4+
workflow_call:
55

66
jobs:
77
stale:
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
name: Check for unused imports using Pylint
2+
23
on:
3-
pull_request_target:
4-
branches:
5-
- current
6-
- sagitta
4+
workflow_call:
75

86
jobs:
9-
Check-Unused-Imports:
7+
check-unused-imports:
108
runs-on: ubuntu-latest
119
steps:
1210
- uses: actions/checkout@v3
11+
1312
- name: Set up Python
1413
uses: actions/setup-python@v3
1514
with:
1615
python-version: 3.11
16+
1717
- name: Install dependencies
1818
run: |
1919
python -m pip install --upgrade pip
2020
pip install pylint
21+
2122
- name: Analysing the code with pylint
22-
run: make unused-imports
23+
run: |
24+
pylint_files=$(git ls-files *.py src/migration-scripts)
25+
pylint --disable=all --enable=W0611 $(pylint_files)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# This workflow helps to analyze repository code for vulnerabilities, bugs, and other errors using CodeQL.
2+
# For that CodeQL Action is used: https://github.com/github/codeql-action
3+
# Learn more about CodeQL at https://codeql.github.com/
4+
5+
name: CodeQL
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
languages:
11+
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."
12+
required: false
13+
type: string
14+
default: "['python']"
15+
codeql-cfg-path:
16+
description: "Optional input to set path to a CodeQL config file"
17+
required: false
18+
type: string
19+
build-command:
20+
description: "Optional input to specify manual build command. The multiline syntax is supported"
21+
required: false
22+
type: string
23+
24+
jobs:
25+
analyze:
26+
name: Analyze
27+
runs-on: ubuntu-latest
28+
permissions:
29+
actions: read
30+
contents: read
31+
security-events: write
32+
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
language: ${{fromJson(inputs.languages)}}
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
# Initializes the CodeQL tools for scanning.
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v3
45+
with:
46+
languages: ${{matrix.language}}
47+
config-file: ${{inputs.codeql-cfg-path}}
48+
49+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
50+
# If this step fails, configure a build command manually using build-command input. This command will be executed in the corresponding step.
51+
- name: Autobuild
52+
if: ${{!inputs.build-command}}
53+
uses: github/codeql-action/autobuild@v3
54+
55+
- name: Manual build
56+
if: ${{inputs.build-command}}
57+
run: |
58+
${{inputs.build-command}}
59+
60+
- name: Perform CodeQL Analysis
61+
uses: github/codeql-action/analyze@v3

.github/workflows/mergifyio_backport.yml renamed to .github/workflows/label-backport.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
name: Mergifyio backport
1+
name: Label backport
22

3-
on: [issue_comment]
3+
on:
4+
workflow_call:
45

56
jobs:
67
mergifyio_backport:

.github/workflows/pull-request-management.yml renamed to .github/workflows/lint-j2.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
name: Build Pull Request Package
33

44
on:
5-
pull_request:
6-
branches:
7-
- current
8-
- sagitta
9-
- equuleus
5+
workflow_call:
106

117
jobs:
128
j2lint:

.github/workflows/pull-request-message-check.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)