From c99532d1dd3a6fbdc8823bc027060b7f27b02bb0 Mon Sep 17 00:00:00 2001 From: "Satadru Pramanik, DO, MPH, MEng" Date: Fri, 20 Dec 2024 01:25:05 -0500 Subject: [PATCH] Add Actionlint workflow, fix Build workflow. (#11016) * Add Actionlint workflow, fix Build workflow. Signed-off-by: Satadru Pramanik * More Linting... Signed-off-by: Satadru Pramanik * Update actionlint version. Signed-off-by: Satadru Pramanik * Adjust actionlint flags. Signed-off-by: Satadru Pramanik * Make fail_level none for actionlint until upstream bugs are fixed. Signed-off-by: Satadru Pramanik --------- Signed-off-by: Satadru Pramanik --- .github/workflows/Actionlint.yml | 21 +++++++++++++++++++++ .github/workflows/Build.yml | 3 +++ .github/workflows/Linter-Handoff.yml | 5 +++++ .github/workflows/Markdown-lint.yml | 5 ++++- .github/workflows/Rubocop.yml | 5 ++++- .github/workflows/ShellCheck.yml | 5 ++++- .github/workflows/YAMLlint.yml | 5 ++++- 7 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/Actionlint.yml diff --git a/.github/workflows/Actionlint.yml b/.github/workflows/Actionlint.yml new file mode 100644 index 000000000..4e753a029 --- /dev/null +++ b/.github/workflows/Actionlint.yml @@ -0,0 +1,21 @@ +--- +name: ActionLint +on: workflow_call +env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.CREW_PR_TOKEN }} + GH_TOKEN: ${{ secrets.CREW_PR_TOKEN }} + REVIEWDOG_TOKEN: ${{ secrets.CREW_PR_TOKEN }} +jobs: + yamllint: + runs-on: ubuntu-24.04 + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v4 + - name: YAMLLint + uses: reviewdog/action-actionlint@6612efe1589ccf23cb1320d11fced44b86fb5ad7 # Post v1.7.4 commit to support fail_level + with: + actionlint_flags: "-shellcheck ''" + fail_level: none + reporter: github-pr-review diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 1eb6a2308..e4938b856 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -48,6 +48,7 @@ jobs: with: fetch-depth: 0 persist-credentials: true + ref: ${{ inputs.branch || github.ref_name }} - name: Rebase to master run: | git config user.name "${{ github.actor }}" @@ -288,6 +289,7 @@ jobs: with: fetch-depth: 0 persist-credentials: true + ref: ${{ inputs.branch || github.ref_name }} - name: Get all changed manifest files id: changed-manifest-files uses: tj-actions/changed-files@v45 @@ -300,6 +302,7 @@ jobs: git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" git fetch origin + git checkout ${{ env.BRANCH }} git reset --hard origin/${{ env.BRANCH }} git pull --rebase origin master && git push -f git log --oneline -10 diff --git a/.github/workflows/Linter-Handoff.yml b/.github/workflows/Linter-Handoff.yml index 0f9b5e9d8..edcd0b1e3 100644 --- a/.github/workflows/Linter-Handoff.yml +++ b/.github/workflows/Linter-Handoff.yml @@ -55,6 +55,10 @@ jobs: needs: handoff if: contains(needs.handoff.outputs.category, 'YAML') uses: ./.github/workflows/YAMLlint.yml + action-yaml: + needs: handoff + if: contains(needs.handoff.outputs.category, 'YAML') + uses: ./.github/workflows/Actionlint.yml linter-tests: runs-on: ubuntu-24.04 needs: @@ -63,6 +67,7 @@ jobs: - ruby - bash - yaml + - action-yaml if: ${{ !cancelled() }} steps: - name: fail if linter jobs failed diff --git a/.github/workflows/Markdown-lint.yml b/.github/workflows/Markdown-lint.yml index c165142c5..5c0c31796 100644 --- a/.github/workflows/Markdown-lint.yml +++ b/.github/workflows/Markdown-lint.yml @@ -1,6 +1,9 @@ --- name: Markdown-lint on: workflow_call +env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.CREW_PR_TOKEN }} + GH_TOKEN: ${{ secrets.CREW_PR_TOKEN }} jobs: markdown-lint: runs-on: ubuntu-24.04 @@ -14,4 +17,4 @@ jobs: with: fail_level: any markdownlint_flags: '-s .mdl_style.rb' - reporter: github-pr-check + reporter: github-pr-review diff --git a/.github/workflows/Rubocop.yml b/.github/workflows/Rubocop.yml index 8ac10b1e0..1af8aaa61 100644 --- a/.github/workflows/Rubocop.yml +++ b/.github/workflows/Rubocop.yml @@ -1,6 +1,9 @@ --- name: Rubocop on: workflow_call +env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.CREW_PR_TOKEN }} + GH_TOKEN: ${{ secrets.CREW_PR_TOKEN }} jobs: rubocop: runs-on: ubuntu-24.04 @@ -18,4 +21,4 @@ jobs: fail_level: any filter_mode: nofilter only_changed: true - reporter: github-pr-check + reporter: github-pr-review diff --git a/.github/workflows/ShellCheck.yml b/.github/workflows/ShellCheck.yml index 00a23a4d4..44c669215 100644 --- a/.github/workflows/ShellCheck.yml +++ b/.github/workflows/ShellCheck.yml @@ -1,6 +1,9 @@ --- name: ShellCheck on: workflow_call +env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.CREW_PR_TOKEN }} + GH_TOKEN: ${{ secrets.CREW_PR_TOKEN }} jobs: shellcheck: runs-on: ubuntu-24.04 @@ -14,4 +17,4 @@ jobs: with: exclude: './tools/*' fail_level: any - reporter: github-pr-check + reporter: github-pr-review diff --git a/.github/workflows/YAMLlint.yml b/.github/workflows/YAMLlint.yml index 08dc87eb4..c10e38614 100644 --- a/.github/workflows/YAMLlint.yml +++ b/.github/workflows/YAMLlint.yml @@ -1,6 +1,9 @@ --- name: YAMLLint on: workflow_call +env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.CREW_PR_TOKEN }} + GH_TOKEN: ${{ secrets.CREW_PR_TOKEN }} jobs: yamllint: runs-on: ubuntu-24.04 @@ -13,4 +16,4 @@ jobs: uses: reviewdog/action-yamllint@v1 with: fail_level: any - reporter: github-pr-check + reporter: github-pr-review