From 5518bc7bd96e160412a68a6eb130ddac4ea9d433 Mon Sep 17 00:00:00 2001 From: Spencer Runde Date: Wed, 14 Aug 2024 13:06:59 +0000 Subject: [PATCH 1/6] use repo variable to enable tics runs --- .github/workflows/static-analysis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index e1d362ac..7ea7ffae 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,3 +1,8 @@ +# Run static code analysis through Tiobe TiCS +# Requires repository configurations: +# - TICSAUTHTOKEN secret to upload the results +# - RUN_TICS_ANALYSIS repository variable set to truthy value run the workflow + name: TiCS static analysis on: @@ -7,6 +12,7 @@ on: jobs: TICS: runs-on: ubuntu-latest + if: ${{ vars.RUN_TICS_ANALYSIS }} steps: - name: Checkout master branch uses: actions/checkout@v4 From 9c7a8c48b170a14d15148536431ac918b5c52af9 Mon Sep 17 00:00:00 2001 From: Spencer Runde Date: Wed, 14 Aug 2024 22:50:54 +0000 Subject: [PATCH 2/6] check for secret directly --- .github/workflows/static-analysis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 7ea7ffae..563eea3f 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,7 +1,6 @@ # Run static code analysis through Tiobe TiCS -# Requires repository configurations: +# Requires repository configuration: # - TICSAUTHTOKEN secret to upload the results -# - RUN_TICS_ANALYSIS repository variable set to truthy value run the workflow name: TiCS static analysis @@ -12,8 +11,13 @@ on: jobs: TICS: runs-on: ubuntu-latest - if: ${{ vars.RUN_TICS_ANALYSIS }} steps: + - name: Check TICSAUTHTOKEN + run: | + if [ -z "${{ secrets.TICSAUTHTOKEN }}" ]; then + echo "::notice::Repository secret TICSAUTHTOKEN not set. Skipping." + exit 0 + fi - name: Checkout master branch uses: actions/checkout@v4 with: From 94214e35db95e9aba06ddd18644ad35413bebb56 Mon Sep 17 00:00:00 2001 From: Spencer Runde Date: Thu, 15 Aug 2024 15:23:57 +0000 Subject: [PATCH 3/6] check for secret in separate step --- .github/workflows/static-analysis.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 563eea3f..bfc44a0d 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -8,16 +8,26 @@ on: workflow_dispatch: schedule: - cron: '0 6 * * *' # Run at 6:00a (arbitrary) to avoid peak activity on runners + jobs: - TICS: + check-configuration: runs-on: ubuntu-latest + outputs: + should-run: $${ steps.check-token.outputs.should-run }} steps: - - name: Check TICSAUTHTOKEN + - id: check-token run: | - if [ -z "${{ secrets.TICSAUTHTOKEN }}" ]; then + if [ -n "${{ secrets.TICSAUTHTOKEN }}" ]; then + echo "should-run=true" + else echo "::notice::Repository secret TICSAUTHTOKEN not set. Skipping." - exit 0 fi + + TICS: + runs-on: ubuntu-latest + needs: check-configuration + if: needs.check-configuration.outputs.should-run == 'true' + steps: - name: Checkout master branch uses: actions/checkout@v4 with: From 76cf95ee3def865f0b0018b4bad4996c2d3f85a8 Mon Sep 17 00:00:00 2001 From: Spencer Runde Date: Thu, 15 Aug 2024 15:30:03 +0000 Subject: [PATCH 4/6] exit 1 for skipped run --- .github/workflows/static-analysis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index bfc44a0d..3ae95218 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -21,6 +21,7 @@ jobs: echo "should-run=true" else echo "::notice::Repository secret TICSAUTHTOKEN not set. Skipping." + exit 1 fi TICS: From f62ef4da6e01d52ea4357abc57a1eff3e07ada9e Mon Sep 17 00:00:00 2001 From: Spencer Runde Date: Thu, 10 Oct 2024 13:48:28 +0000 Subject: [PATCH 5/6] ci: run tiobe weekly to reduce infra load --- .github/workflows/static-analysis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 3ae95218..354664ad 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -4,10 +4,11 @@ name: TiCS static analysis +# Temporary: reduce frequency to once-weekly to reduce infra load on: workflow_dispatch: schedule: - - cron: '0 6 * * *' # Run at 6:00a (arbitrary) to avoid peak activity on runners + - cron: '0 6 * * 0' # Run at 6:00a (arbitrary) to avoid peak activity on runners jobs: check-configuration: From 5c7d176bcdc39b76b614f9ea6deae8486bae0828 Mon Sep 17 00:00:00 2001 From: Spencer Runde Date: Tue, 15 Oct 2024 16:21:51 +0000 Subject: [PATCH 6/6] revert changes from personal tests --- .github/workflows/static-analysis.yml | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 354664ad..d6570241 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,34 +1,13 @@ -# Run static code analysis through Tiobe TiCS -# Requires repository configuration: -# - TICSAUTHTOKEN secret to upload the results - name: TiCS static analysis -# Temporary: reduce frequency to once-weekly to reduce infra load +# Temp: run once weekly to reduce infra load on: workflow_dispatch: schedule: - cron: '0 6 * * 0' # Run at 6:00a (arbitrary) to avoid peak activity on runners - jobs: - check-configuration: - runs-on: ubuntu-latest - outputs: - should-run: $${ steps.check-token.outputs.should-run }} - steps: - - id: check-token - run: | - if [ -n "${{ secrets.TICSAUTHTOKEN }}" ]; then - echo "should-run=true" - else - echo "::notice::Repository secret TICSAUTHTOKEN not set. Skipping." - exit 1 - fi - TICS: runs-on: ubuntu-latest - needs: check-configuration - if: needs.check-configuration.outputs.should-run == 'true' steps: - name: Checkout master branch uses: actions/checkout@v4