From cfbcfad1f20694348507d5f794c8d1b7a1fe459a Mon Sep 17 00:00:00 2001 From: "James M. Greene" Date: Thu, 11 Feb 2021 09:50:37 -0600 Subject: [PATCH] Re-enable the Actions workflow linter using the latest version (#17399) * Re-enable the Actions workflow linter using the latest version * Update to the latest actions-linter * Update to the latest actions-linter * Rely on secrets.FREEZE directly rather than setting a duplicate env var * Fix workflow error by using secrets.FREEZE directly as this one doesn't actually set a duplicate env var in the first place! * Update to latest actions-linter * Use ${{}} expression syntax * Readd env.FREEZE to necessary workflows since secrets cannot be checked in 'if' conditions * Readd the comment to the GraphQL updating workflow about the FREEZE secret * Upgrade actions-linter --- .github/allowed-actions.js | 2 +- .github/workflows/remove-unused-assets.yml | 6 +++--- .github/workflows/repo-freeze-check.yml | 2 +- .github/workflows/repo-sync-stalls.yml | 6 ++++++ .github/workflows/update-graphql-files.yml | 17 +++++++++-------- .github/workflows/workflow-lint.yml | 10 +++++----- 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/allowed-actions.js b/.github/allowed-actions.js index 06041f7e2e..bd1b1ffcbe 100644 --- a/.github/allowed-actions.js +++ b/.github/allowed-actions.js @@ -13,7 +13,7 @@ module.exports = [ 'actions/stale@af4072615903a8b031f986d25b1ae3bf45ec44d4', //actions/stale@v3.0.13 'crowdin/github-action@fd9429dd63d6c0f8a8cb4b93ad8076990bd6e688', 'crykn/copy_folder_to_another_repo_action@0282e8b9fef06de92ddcae9fe6cb44df6226646c', - 'cschleiden/actions-linter@43fd4e08e52ed40c0e2782dc2425694388851576', + 'cschleiden/actions-linter@0ff16d6ac5103cca6c92e6cbc922b646baaea5be', 'dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911', 'docker://chinthakagodawita/autoupdate-action:v1', 'fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289', diff --git a/.github/workflows/remove-unused-assets.yml b/.github/workflows/remove-unused-assets.yml index b503ff874d..c64a3163af 100644 --- a/.github/workflows/remove-unused-assets.yml +++ b/.github/workflows/remove-unused-assets.yml @@ -1,12 +1,12 @@ name: Remove unused assets -env: - FREEZE: ${{ secrets.FREEZE }} - on: schedule: - cron: '20 15 * * 0' # run every Sunday at 20:15 UTC / 12:15 PST +env: + FREEZE: ${{ secrets.FREEZE }} + jobs: remove_unused_assets: name: Remove unused assets diff --git a/.github/workflows/repo-freeze-check.yml b/.github/workflows/repo-freeze-check.yml index c3f2f8e65d..7611d3ee54 100644 --- a/.github/workflows/repo-freeze-check.yml +++ b/.github/workflows/repo-freeze-check.yml @@ -16,7 +16,7 @@ env: jobs: check-freezer: - if: github.repository == 'github/docs-internal' || github.repository == 'github/docs' + if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }} name: Prevent merging during deployment freezes runs-on: ubuntu-latest steps: diff --git a/.github/workflows/repo-sync-stalls.yml b/.github/workflows/repo-sync-stalls.yml index 36cf671a6d..fe05263157 100644 --- a/.github/workflows/repo-sync-stalls.yml +++ b/.github/workflows/repo-sync-stalls.yml @@ -1,8 +1,13 @@ name: Repo Sync Stalls + on: workflow_dispatch: schedule: - cron: '0 */2 * * *' + +env: + FREEZE: ${{ secrets.FREEZE }} + jobs: check-freezer: name: Check for deployment freezes @@ -13,6 +18,7 @@ jobs: run: | echo 'The repo is currently frozen! Exiting this workflow.' exit 1 # prevents further steps from running + repo-sync-stalls: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/update-graphql-files.yml b/.github/workflows/update-graphql-files.yml index 7dff9b1a32..555383f52b 100644 --- a/.github/workflows/update-graphql-files.yml +++ b/.github/workflows/update-graphql-files.yml @@ -1,18 +1,19 @@ name: Update GraphQL files -# **IMPORTANT:** Do not change the FREEZE environment variable set here. -# This workflow runs every hour. To temporarily disable it (for example, during -# a docs freeze), add a secret to the docs repo settings called `FREEZE` -# with a value of `true`. To reenable GraphQL updates, delete the secret in -# the repo settings. The env variable here will evaluate whether the secret exists. -env: - FREEZE: ${{ secrets.FREEZE }} - on: workflow_dispatch: schedule: - cron: '20 16 * * *' # run every day at 16:20 UTC / 8:20 PST +# **IMPORTANT:** Do not change the FREEZE environment variable set here! +# This workflow runs on a recurring basis. To temporarily disable it (e.g., +# during a docs deployment freeze), add an Actions Secret to the repo settings +# called `FREEZE` with a value of `true`. To re-enable GraphQL updates, simply +# delete that Secret from the repo settings. The environment variable here +# will duplicate that Secret's value for later evaluation. +env: + FREEZE: ${{ secrets.FREEZE }} + jobs: update_graphql_files: if: github.repository == 'github/docs-internal' diff --git a/.github/workflows/workflow-lint.yml b/.github/workflows/workflow-lint.yml index 66d9562a0e..8aa08f3238 100644 --- a/.github/workflows/workflow-lint.yml +++ b/.github/workflows/workflow-lint.yml @@ -2,10 +2,10 @@ name: Lint workflows on: workflow_dispatch: - # push: - # branches: - # - main - # pull_request: + push: + branches: + - main + pull_request: jobs: lint: @@ -16,6 +16,6 @@ jobs: uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f - name: Run linter - uses: cschleiden/actions-linter@43fd4e08e52ed40c0e2782dc2425694388851576 + uses: cschleiden/actions-linter@0ff16d6ac5103cca6c92e6cbc922b646baaea5be with: workflows: '[".github/workflows/*.yml"]'