File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,10 +2,16 @@ name: Run precommit checks on self
22on : pull_request
33jobs :
44 precommit-check :
5- runs-on : ubuntu-latest
5+ runs-on : ${{ matrix.os }}
6+ strategy :
7+ matrix :
8+ os : [ ubuntu-latest, macos-latest, windows-latest]
69 steps :
710 - uses : actions/checkout@v2
811 with :
912 ref : ${{ github.head_ref }}
1013 fetch-depth : 0
11- - uses : ccdc-opensource/commit-hooks@precommit_action
14+ - uses : actions/setup-python@v2
15+ with :
16+ python-version : " 3.7"
17+ - uses : ccdc-opensource/commit-hooks@composite_steps
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11This repository contains files that can be used as a github action and local
22git hooks.
33
4- It does a few checks on source codes to ensure compliance with some general
4+ It does a few checks on source code to ensure compliance with some general
55CCDC coding standard.
66
77The commit will be flagged if it includes certain text files with:
3131 branches : [ main ]
3232jobs :
3333 Pull-request-files-check :
34- runs-on : ubuntu-latest
34+ runs-on : ${{ matrix.os }}
35+ strategy :
36+ matrix :
37+ os : [ ubuntu-latest, macos-latest, windows-latest]
3538 steps :
3639 - uses : actions/checkout@v2
3740 with :
3841 ref : ${{ github.head_ref }}
3942 fetch-depth : 0
40- - uses : ccdc-opensource/commit-hooks@v1
43+ - uses : actions/setup-python@v2
44+ with :
45+ python-version : " 3.7"
46+ - uses : ccdc-opensource/commit-hooks@v2
4147` ` `
4248
4349# commit-hooks
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ name: CCDC File Checks
22author : CCDC
33description : Check changed files for compliance
44runs :
5- using : " docker"
6- image : " Dockerfile"
5+ using : " composite"
6+ steps :
7+ - run : python3 $GITHUB_ACTION_PATH/main.py
8+ shell : bash
79branding :
810 icon : ' check-square'
911 color : ' green'
Original file line number Diff line number Diff line change 1818# Absolute file size limit (in MB) - it's 100MB on github.com
1919HARD_SIZE_THRESHOLD = 99.0
2020# Internal file size limit (in MB) - allow if commit message includes marker
21- SOFT_SIZE_THRESHOLD = 60 .0
21+ SOFT_SIZE_THRESHOLD = 5 .0
2222# Large file marker in commit message
2323LARGE_FILE_MARKER = 'LARGE_FILE'
2424# Check file content if it has these extensions
@@ -102,7 +102,14 @@ def get_branch():
102102
103103
104104def get_sha ():
105- '''Get the commit sha'''
105+ '''Get the commit sha
106+
107+ The sha of the branch we are interested in, ie. the tip of the branch that
108+ is pushed or to be merged to main.
109+
110+ GITHUB_SHA cannot be used because in a pull request it gives the sha of the
111+ fake merge commit.
112+ '''
106113 return _get_output (f'git rev-parse { get_branch ()} ' )
107114
108115
You can’t perform that action at this time.
0 commit comments