From cb3f239e7d3121384d0c413b11dd861325c9d241 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Thu, 21 Sep 2023 12:46:03 -0700 Subject: [PATCH 1/2] Perform sparse checkout of just the .github folder for the header check instead of all the files. Update python checkout version being used. Update the version of the get changed files action being used. --- .github/workflows/kernel-checks.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/kernel-checks.yml b/.github/workflows/kernel-checks.yml index 679ede23e3..4143dfde82 100644 --- a/.github/workflows/kernel-checks.yml +++ b/.github/workflows/kernel-checks.yml @@ -9,10 +9,7 @@ jobs: steps: # Install python 3 - name: Tool Setup - uses: actions/setup-python@v2 - with: - python-version: 3.7.10 - architecture: x64 + uses: actions/setup-python@v3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -21,6 +18,7 @@ jobs: uses: actions/checkout@v3 with: repository: FreeRTOS/FreeRTOS + sparse-checkout: '.github' ref: main path: tools @@ -32,7 +30,7 @@ jobs: # Collect all affected files - name: Collecting changed files - uses: lots0logs/gh-action-get-changed-files@2.1.4 + uses: lots0logs/gh-action-get-changed-files@2.2.2 with: token: ${{ secrets.GITHUB_TOKEN }} From 6b7f4ee38eef62680dffa12ddddc006bc788d219 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Thu, 21 Sep 2023 12:52:22 -0700 Subject: [PATCH 2/2] Use echo groups on the header check --- .github/workflows/kernel-checks.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kernel-checks.yml b/.github/workflows/kernel-checks.yml index 4143dfde82..cfaec5b121 100644 --- a/.github/workflows/kernel-checks.yml +++ b/.github/workflows/kernel-checks.yml @@ -35,10 +35,35 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} # Run checks - - name: Check File Headers + - env: + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m + stepName: Check File Headers + name: ${{ env.stepName }} + shell: bash run: | + # ${{ env.stepName }} + echo -e "::group::${{ env.bashInfo }} Install Dependencies ${{ env.bashEnd }}" + + # Copy the common tools from the FreeRTOS/FreeRTOS repo. mv tools/.github/scripts/common inspect/.github/scripts + + # Install the necessary python dependencies pip install -r inspect/.github/scripts/common/requirements.txt cd inspect + + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" + + # Use the python script to check the copyright header of modified files. .github/scripts/kernel_checker.py --json ${HOME}/files_modified.json ${HOME}/files_added.json ${HOME}/files_renamed.json - exit $? + exitStatus=$? + echo -e "::endgroup::" + + if [ $exitStatus -eq 0 ]; then + echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" + else + echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" + fi + exit $exitStatus