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

Ci/gha linters #62

Merged
merged 2 commits into from
Apr 10, 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
57 changes: 57 additions & 0 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Github Workflows syntax"

on:
pull_request:

env:
NODE_VERSION: 20
PYTHON_VERSION: '3.12'

jobs:
pre-commit:
name: 'Execute pre-commit rules'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Run pre-commit rules
uses: pre-commit/[email protected]

workflow-validation:
name: Github Action Workflows validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: reviewdog/action-actionlint@v1

tag-release:
name: Github release
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'main' }}
needs:
- pre-commit
- workflow-validation
permissions:
contents: write
outputs:
released_version: ${{ steps.release.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false

- name: "Semantic release"
id: release
uses: "meero-com/github-actions-shared-workflows/actions/release/semantic@main"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
npm-token: ${{ secrets.NPM_TOKEN }}
branch: 'main'
15 changes: 0 additions & 15 deletions .github/workflows/workflows.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
default_install_hook_types: [commit-msg, pre-commit]
repos:
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.4.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional']

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.1
hooks:
- id: check-github-workflows
- id: check-github-actions
files: action\.(yml|yaml)
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ Beware of using a `@ref` (`@main` in the example above) which suits your stabili

* Use `@main` if you always want to use the latest version of the workflow.
* Use `@<tag>` if you wan to use a specific frozen version of the workflow.

## Local Development

This repository use pre-commit

- [install pre-commit](https://pre-commit.com/index.html#install)
- run once `pre-commit install` to automatically execute pre-commit hooks at commit
- run `pre-commit run -a` whenever you want to run hooks on the complete repository
5 changes: 2 additions & 3 deletions actions/precommit/render-openapi-template/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ outputs:
description: "Api Gateway file artifact name"
value: openapi-${{ inputs.OPENAPI_API_NAME }}-${{ inputs.version_identifier }}.json

env:
PYTHON_VERSION: '3.10'

runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v4
env:
PYTHON_VERSION: '3.10'
with:
python-version: ${{ env.PYTHON_VERSION }}

Expand Down
6 changes: 6 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-empty': [2, 'never'],
}
};
Loading