Skip to content

Commit fd4e80c

Browse files
authored
Added workflow files
1 parent fd3b706 commit fd4e80c

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

megalinter.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
# MegaLinter GitHub Action configuration file
3+
# More info at https://megalinter.io
4+
# CAMARA Project - Github Action for Pull Reqests
5+
# 31.01.2024 - initial version
6+
7+
name: MegaLinter
8+
9+
on: # yamllint disable-line rule:truthy
10+
# Pull Requests to main
11+
pull_request:
12+
branches: [master, main]
13+
14+
env: # Comment env block if you do not want to apply fixes
15+
# Apply linter fixes configuration
16+
APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
17+
APPLY_FIXES_EVENT: pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
18+
APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)
19+
20+
concurrency:
21+
group: ${{ github.ref }}-${{ github.workflow }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
build:
26+
name: MegaLinter
27+
runs-on: ubuntu-latest
28+
permissions:
29+
# Give the default GITHUB_TOKEN write permission to commit and push, comment issues & post new PR
30+
# Remove the ones you do not need
31+
contents: write
32+
issues: write
33+
pull-requests: write
34+
steps:
35+
# Git Checkout
36+
- name: Checkout Code
37+
uses: actions/checkout@v4
38+
with:
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances
41+
- name: Install Spectral
42+
run: npm install -g @stoplight/spectral
43+
- name: Install Spectral functions
44+
run: npm install -g @stoplight/spectral-functions
45+
# - name: Run spectral:oas Spectral Linting
46+
# run: spectral lint code/API_definitions/*.yaml --verbose --ruleset .spectral.yml
47+
# Replace openapi.yaml file with your API specification file
48+
49+
# MegaLinter
50+
- name: MegaLinter
51+
id: ml
52+
# You can override MegaLinter flavor used to have faster performances
53+
# More info at https://megalinter.io/flavors/
54+
uses: oxsecurity/megalinter/flavors/[email protected]
55+
env:
56+
# All available variables are described in documentation
57+
# https://megalinter.io/configuration/
58+
PRINT_ALPACA: false
59+
# VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Override with true if you always want to lint all sources
60+
VALIDATE_ALL_CODEBASE: true
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
# ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
63+
DISABLE: COPYPASTE,MARKDOWN
64+
DISABLE_LINTERS: SPELL_CSPELL,SPELL_LYCHEE,YAML_PRETTIER,REPOSITORY_GRYPE, REPOSITORY_SEMGREP,REPOSITORY_DEVSKIM,REPOSITORY_KICS,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,REPOSITORY_CHECKOV,REPOSITORY_GITLEAKS,YAML_V8R,JAVA_PMD,JAVA_CHECKSTYLE
65+
YAML_YAMLLINT_CONFIG_FILE: ".yamllint.yaml"
66+
OPENAPI_SPECTRAL_CONFIG_FILE: ".spectral.yml"
67+
YAML_YAMLLINT_FILTER_REGEX_INCLUDE: "(code/)"
68+
OPENAPI_SPECTRAL_FILTER_REGEX_INCLUDE: "(code/)"
69+
70+
# Upload MegaLinter artifacts
71+
- name: Archive production artifacts
72+
if: ${{ success() }} || ${{ failure() }}
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: MegaLinter reports
76+
path: |
77+
megalinter-reports
78+
mega-linter.log

spectral_oas_lint.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
# CAMARA Project - workflow configuration to manually run CAMARA OAS rules
3+
# see https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow
4+
# 31.01.2024 - initial version
5+
6+
name: Spectral manual run
7+
8+
on: workflow_dispatch
9+
10+
concurrency:
11+
group: ${{ github.ref }}-${{ github.workflow }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
name: Spectral linting
17+
runs-on: ubuntu-latest
18+
permissions:
19+
# Give the default GITHUB_TOKEN write permission to commit and push, comment issues & post new PR
20+
# Remove the ones you do not need
21+
contents: write
22+
issues: write
23+
pull-requests: write
24+
steps:
25+
# Git Checkout
26+
- name: Checkout Code
27+
uses: actions/checkout@v4
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances
31+
- name: Install Spectral
32+
run: npm install -g @stoplight/spectral
33+
- name: Install Spectral functions
34+
run: npm install -g @stoplight/spectral-functions
35+
- name: Run Spectral linting
36+
run: spectral lint code/API_definitions/*.yaml --verbose --ruleset .spectral.yml

0 commit comments

Comments
 (0)