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

[ATL-1386] Add simple rules #2

Merged
merged 1 commit into from
Jul 12, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Apollo maintainers (Jesus Diaz Vico, Shota Jolbordi):
/apollo/ @jesusdiazvico @shotexa

# Castor maintainers (Ilya Peresadin, Fabio Pinheiro):
/castor/ @pva701 @FabioPinheiro

# Mercury maintainers (Fabio Pinheiro, Shailesh Patil):
/mercury/ @FabioPinheiro @mineme0110

# Pluto maintainers (Ilya Peresadin, Yurii Shynbuiev):
/pluto/ @pva701 @yshyn-iohk

# Pollux maintainers (Shota Jolbordi, Yurii Shynbuiev):
/pollux/ @shotexa @yshyn-iohk

# Github maintainer (Anton Baliasnikov):
/.github/ @antonbaliasnikov

# Everything else will be reviewed by someone from the Atala group
* @input-output-hk/atala
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Overview
<!-- What this PR does, and why is needed, a useful description is expected, and relevant tickets should be mentioned -->
Fixes ATL-xxxx

# Added features
<!-- Short list of new features/fixes added -->
- [ ]
# Checklist
<!-- Details you need to consider that are commonly forgotten -->
<!-- Pre-submit checklist should be marked as completed when PR moves out from DRAFT -->
- [ ] Self-reviewed the diff
- [ ] New code has inline documentation
- [ ] New code has proper comments/tests
- [ ] Any changes not covered by tests have been tested manually
17 changes: 17 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repo:
- "*"
apollo:
- apollo/**/*
castor:
- castor/**/*
mercury:
- mercury/**/*
pluto:
- pluto/**/*
pollux:
- pollux/**/*
ci:
- .github/**/*
docs:
- docs/**/*
- README.md
11 changes: 11 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.ATALA_GITHUB_TOKEN }}"
71 changes: 71 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Linter

# Default shell is `sh`
# which is old, use bourne-again version instead
defaults:
run:
shell: bash

on:
push:
branches:
- main
pull_request:

jobs:
lint:
name: Lint changes
runs-on: ubuntu-latest
env:
APPLY_FIXES: all
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit
VALIDATE_ALL_CODEBASE: ${{ github.ref_name == 'main' }}
DISABLE: COPYPASTE,SPELL
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
token: ${{ secrets.ATALA_GITHUB_TOKEN }}
fetch-depth: 0
- name: Mega-Linter
id: ml
uses: megalinter/megalinter@v5
- name: Prepare commit
if: |
(success() || failure()) &&
steps.ml.outputs.has_updated_sources == 1 &&
github.event_name == 'pull_request'
run: sudo chown -Rc ${UID} .git/
- name: Import GPG key
id: import_gpg
if: |
(success() || failure()) &&
steps.ml.outputs.has_updated_sources == 1 &&
github.event_name == 'pull_request'
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
git-user-signingkey: true
git-commit-gpgsign: true
- name: Commit and push applied linter fixes
if: |
(success() || failure()) &&
steps.ml.outputs.has_updated_sources == 1 &&
github.event_name == 'pull_request'
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.event.pull_request.head.ref }}
commit_message: "[Mega-Linter] Apply linters fixes"
commit_options: "--gpg-sign"
commit_user_name: ${{ steps.import_gpg.outputs.name }}
commit_user_email: ${{ steps.import_gpg.outputs.email }}
- name: Archive production artifacts
if: success() || failure()
uses: actions/upload-artifact@v2
with:
name: Mega-Linter reports
path: |
report
mega-linter.log
64 changes: 64 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Check PR

env:
# Maximum number of lines allowed to be changed in one PR
MAX_CHANGED_LINES: 500
PR_TITLE_MAX_LENGTH: 70
# Title must be `[ATL-1234] ...`
PR_TITLE_REGEXP: '\[\w+-\d+\] .+'

defaults:
run:
shell: bash

on:
pull_request:
types: [opened, edited, synchronize, reopened]

jobs:
check-pr-title:
name: "Check PR title"
runs-on: ubuntu-latest
steps:
- uses: deepakputhraya/action-pr-title@master
name: Validate PR Title
with:
regex: ${{ env.PR_TITLE_REGEXP }}
max_length: ${{ env.PR_TITLE_MAX_LENGTH }}
github_token: ${{ secrets.ATALA_GITHUB_TOKEN }}
- uses: mshick/add-pr-comment@v1
name: Comment on PR
if: failure()
env:
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
with:
message: |
Please fix the title of this PR.<br>
If you don't have ATL number, you must create it.<br>
Examples:
* `[ATL-1234] New feature description`
* `[ATL-1234] [HUGE] Huge new feature description (mind the space between ] and [)`
check-pr-size:
name: "Check PR size"
runs-on: ubuntu-latest
env:
TITLE: ${{ github.event.pull_request.title }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Get diff
uses: technote-space/get-diff-action@v5
with:
SET_ENV_NAME_LINES: LINES_CHANGED
- name: Check diff size
run: |
echo "This PR changes: ${LINES_CHANGED} lines"
if [[ ${TITLE} =~ [HUGE] ]]; then
echo "PR marked as [HUGE], skipping size check."
exit 0
fi
if (( LINES_CHANGED > MAX_CHANGED_LINES )); then
echo "ERROR: This PR changes more than ${MAX_CHANGED_LINES} lines."
echo "Please, separate this PR to small parts. Thanks!"
exit 1
fi
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.idea
report
20 changes: 20 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Configuration file for Mega-Linter
# See all available variables at https://megalinter.github.io/configuration/

APPLY_FIXES: all
DEFAULT_BRANCH: main
DISABLE: [COPYPASTE, SPELL, CREDENTIALS]
SHOW_ELAPSED_TIME: false
FILEIO_REPORTER: false
FLAVOR_SUGGESTIONS: false
PRINT_ALPACA: false
VALIDATE_ALL_CODEBASE: false
SHOW_SKIPPED_LINTERS: false
LOG_LEVEL: INFO
# This pre-command fixes complex CLRF bug
# when MegaLinter takes changes, it checkouts code twice
# that could lead to new files in workspace created
# with CLRF instead of CL due docker/python/git chain
PRE_COMMANDS:
- command: git config --global core.autocrlf input
cwd: "workspace"
Empty file added CONTRIBUTING.md
Empty file.
Empty file added docs/.gitkeep
Empty file.