Skip to content

Commit

Permalink
CI: introduce running pre-commit in Prepare step
Browse files Browse the repository at this point in the history
  • Loading branch information
0penBrain committed May 26, 2023
1 parent f039956 commit 6549654
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/sub_prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ on:
default: "48"
type: string
required: false
dontFailOnPrecommit:
default: true
type: boolean
required: false
outputs:
reportFile:
value: ${{ jobs.Prepare.outputs.reportFile }}
Expand Down Expand Up @@ -139,6 +143,28 @@ jobs:
cat ${{ env.logdir }}changedFiles.lst >> ${{env.reportdir}}${{ env.reportfilename }}
echo "</details>" >> ${{env.reportdir}}${{ env.reportfilename }}
echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
- name: Running pre-commit
continue-on-error: ${{ inputs.dontFailOnPrecommit }}
run: |
set -x
sudo apt-get install -y --no-install-recommends pre-commit
BASEADDR="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/raw/$headSha"
mkdir precommit
cd precommit
git init
wget $BASEADDR/.pre-commit-config.yaml
mkdir files
pushd files
for file in $(cat ${{ env.logdir }}changedFiles.lst)
do
if [ $(dirname "$file") != '.' ]
then
mkdir -p $(dirname $file)
fi
wget -O $file $BASEADDR/$file
done
popd
pre-commit run --files $(find files/ -type f)
- name: Transmitting outputs
id: Output
run: |
Expand Down

0 comments on commit 6549654

Please sign in to comment.