From cc81be9274860b9c6c65a57da8f25dc778e1f905 Mon Sep 17 00:00:00 2001 From: Matthias Kay Date: Mon, 25 Nov 2024 23:06:41 +0100 Subject: [PATCH] ci: update workflows to 1.3.25 (#30) # Description This PR updates all workflows to the latest version. # Verification Done by the workflows in this feature branch, except for the release workflow. --- .github/workflows/linter.yml | 107 +----------------- .github/workflows/pull-request.yml | 49 -------- .github/workflows/pull_request.yml | 18 +++ .github/workflows/release.yml | 25 +--- .github/workflows/release_dry_run.yml | 14 +++ .github/workflows/renovate_auto_approve.yml | 12 ++ .github/workflows/renvovate-auto-approve.yml | 17 --- .github/workflows/slash-ops-command-help.yml | 35 ------ .../workflows/slash-ops-comment-dispatch.yml | 21 ---- .github/workflows/slash_ops_command_help.yml | 14 +++ .../workflows/slash_ops_comment_dispatch.yml | 14 +++ .github/workflows/spelling.yml | 12 +- .github/workflows/stale.yml | 19 +--- .github/workflows/welcome-message.yml | 27 ----- .github/workflows/welcome_message.yml | 14 +++ 15 files changed, 103 insertions(+), 295 deletions(-) delete mode 100644 .github/workflows/pull-request.yml create mode 100644 .github/workflows/pull_request.yml create mode 100644 .github/workflows/release_dry_run.yml create mode 100644 .github/workflows/renovate_auto_approve.yml delete mode 100644 .github/workflows/renvovate-auto-approve.yml delete mode 100644 .github/workflows/slash-ops-command-help.yml delete mode 100644 .github/workflows/slash-ops-comment-dispatch.yml create mode 100644 .github/workflows/slash_ops_command_help.yml create mode 100644 .github/workflows/slash_ops_comment_dispatch.yml delete mode 100644 .github/workflows/welcome-message.yml create mode 100644 .github/workflows/welcome_message.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 63f1dbb..f0eacaf 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -6,106 +6,7 @@ on: pull_request: jobs: - find-changes: - runs-on: ubuntu-latest - steps: - - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - id: changes - with: - filters: | - json: - - '**/*.json' - - markdown: - - '**/*.md' - - renovate-config: - - 'renovate.json' - - 'default.json' - - workflow: - - '.github/workflows/*.yml' - - '.github/workflows/*.yaml' - - yaml: - - '**/*.yaml' - - '**/*.yml' - outputs: - json: ${{ steps.changes.outputs.json }} - markdown: ${{ steps.changes.outputs.markdown }} - renovate-config: ${{ steps.changes.outputs.renovate-config }} - workflow: ${{ steps.changes.outputs.workflow }} - yaml: ${{ steps.changes.outputs.yaml }} - - lint-json: - runs-on: ubuntu-latest - continue-on-error: true - if: needs.find-changes.outputs.json == 'true' - needs: find-changes - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Run JSON Lint - run: bash <(curl -s https://raw.githubusercontent.com/CICDToolbox/json-lint/master/pipeline.sh) - - lint-markdown: - runs-on: ubuntu-latest - continue-on-error: true - if: needs.find-changes.outputs.markdown == 'true' - needs: find-changes - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Validate Markdown file - run: | - npm install -g markdownlint-cli - markdownlint -c .config/markdownlint.yml -i CHANGELOG.md "**/*.md" - - lint-renovate: - runs-on: ubuntu-latest - continue-on-error: true - if: needs.find-changes.outputs.renovate-config == 'true' - needs: find-changes - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - uses: suzuki-shunsuke/github-action-renovate-config-validator@b54483862375f51910a60c4f498e927d4f3df466 # v1.0.1 - - lint-shell: - name: Check shell scripts - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: ShellCheck - uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0 - - lint-workflow: - runs-on: ubuntu-latest - continue-on-error: true - needs: find-changes - if: needs.find-changes.outputs.workflow == 'true' - container: - image: rhysd/actionlint:1.6.27@sha256:d84eca815fc24f72546ec1f2f416d9500ad3349ce7db098cf7a52256f5fd4384 - options: --cpus 1 --user root - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Validate Github workflows - run: | - mkdir .git - actionlint -color - - lint-yaml: - runs-on: ubuntu-latest - continue-on-error: true - needs: find-changes - if: needs.find-changes.outputs.yaml == 'true' - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: yaml-lint - uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1 - with: - config_file: .config/yamllint.yml - strict: true + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_linter_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index 9375759..0000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -name: "Pull Request" - -# yamllint disable-line rule:truthy -on: - pull_request_target: - types: - - opened - - edited - - synchronize - branches-ignore: - - "release-please--branches--*" - -jobs: - main: - name: Validate PR title - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f # v5.4.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - types: | - build - chore - ci - docs - feat - fix - perf - refactor - revert - style - test - # Configure which scopes are allowed. - # deps - dependency updates - # main - for release-please (scope used for releases) - scopes: | - deps - main - requireScope: false - subjectPattern: ^(?![A-Z]).+$ - subjectPatternError: | - The subject "{subject}" found in the pull request title "{title}" - didn't match the configured pattern. Please ensure that the subject - doesn't start with an uppercase character. - wip: true - validateSingleCommit: false - validateSingleCommitMatchesPrTitle: false diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..a04fe50 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,18 @@ +--- +name: "Pull Request" + +# yamllint disable-line rule:truthy +on: + pull_request_target: + types: + - opened + - edited + - synchronize + branches-ignore: + - "release-please--branches--*" + +jobs: + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_pull_request_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21ed4ba..a9452fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ --- -name: Create a release +name: Release # yamllint disable-line rule:truthy on: @@ -8,22 +8,7 @@ on: - main jobs: - release: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/create-github-app-token@78e5f2ddc08efcb88fbbee6cfa3fed770ba550c3 # v1 - id: app-token - with: - app-id: ${{ vars.GET_TOKEN_APP_ID }} - private-key: ${{ secrets.GET_TOKEN_APP_PRIVATE_KEY }} - # bootstrap-sha and release-as needs to be removed after first release - - name: Release - # yamllint disable-line rule:line-length - uses: google-github-actions/release-please-action@a2d8d683f209466ee8c695cd994ae2cf08b1642d # ratchet:google-github-actions/release-please-action@v3 - with: - release-type: python - token: ${{ steps.app-token.outputs.token }} - pull-request-header: '' + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_release_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit diff --git a/.github/workflows/release_dry_run.yml b/.github/workflows/release_dry_run.yml new file mode 100644 index 0000000..2a4e92a --- /dev/null +++ b/.github/workflows/release_dry_run.yml @@ -0,0 +1,14 @@ +--- +name: Release Test + +# yamllint disable-line rule:truthy +on: + push: + branches: + - release-dry-run + +jobs: + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_release_dry_run_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit diff --git a/.github/workflows/renovate_auto_approve.yml b/.github/workflows/renovate_auto_approve.yml new file mode 100644 index 0000000..9a45dc3 --- /dev/null +++ b/.github/workflows/renovate_auto_approve.yml @@ -0,0 +1,12 @@ +--- +name: Approve all Renovate PRs automatically + +# yamllint disable-line rule:truthy +on: + pull_request_target + +jobs: + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_renovate_auto_approve_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit diff --git a/.github/workflows/renvovate-auto-approve.yml b/.github/workflows/renvovate-auto-approve.yml deleted file mode 100644 index 8386a9e..0000000 --- a/.github/workflows/renvovate-auto-approve.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Approve all Renovate PRs automatically - -# yamllint disable-line rule:truthy -on: pull_request_target - -jobs: - auto-approve: - runs-on: ubuntu-latest - permissions: - pull-requests: write - if: github.actor == 'renovate[bot]' - steps: - - uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0 - with: - review-message: "Auto approved Renovate PR by organization" - github-token: ${{ secrets.PAT_FOR_PR_AUTO_APPROVAL }} diff --git a/.github/workflows/slash-ops-command-help.yml b/.github/workflows/slash-ops-command-help.yml deleted file mode 100644 index 6bf2178..0000000 --- a/.github/workflows/slash-ops-command-help.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Execute ChatOps command - -# yamllint disable-line rule:truthy -on: - repository_dispatch: - types: - - help-command - -jobs: - help-command: - name: "ChatOps: /help" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Choose maintainer - id: vars - run: | - maintainer=$(grep -oE "@[a-zA-Z0-9_-]+" CODEOWNERS | shuf -n 1) - echo "maintainer=$maintainer" >> "$GITHUB_OUTPUT" - - - name: Create comment - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - # yamllint disable rule:line-length - script: | - // adds a comment to the PR (there is the issue API, which works work PRs too) - github.rest.issues.createComment({ - issue_number: context.payload.client_payload.github.payload.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Hey there ${{ steps.vars.outputs.maintainer }}, could you please help @${{ github.event.client_payload.github.payload.comment.user.login }} out?' - }) - # yamllint enable rule:line-length diff --git a/.github/workflows/slash-ops-comment-dispatch.yml b/.github/workflows/slash-ops-comment-dispatch.yml deleted file mode 100644 index fa5e2ed..0000000 --- a/.github/workflows/slash-ops-comment-dispatch.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: PR commented - -# yamllint disable-line rule:truthy -on: - issue_comment: - types: - - created - -jobs: - slash-command-dispatch: - runs-on: ubuntu-latest - steps: - - name: Slash Command Dispatch - uses: peter-evans/slash-command-dispatch@13bc09769d122a64f75aa5037256f6f2d78be8c4 # v4.0.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - issue-type: pull-request - reactions: true - commands: | - help diff --git a/.github/workflows/slash_ops_command_help.yml b/.github/workflows/slash_ops_command_help.yml new file mode 100644 index 0000000..3ed53e8 --- /dev/null +++ b/.github/workflows/slash_ops_command_help.yml @@ -0,0 +1,14 @@ +--- +name: Execute ChatOps command + +# yamllint disable-line rule:truthy +on: + repository_dispatch: + types: + - help-command + +jobs: + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_slash_ops_command_help_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit diff --git a/.github/workflows/slash_ops_comment_dispatch.yml b/.github/workflows/slash_ops_comment_dispatch.yml new file mode 100644 index 0000000..78e3e9d --- /dev/null +++ b/.github/workflows/slash_ops_comment_dispatch.yml @@ -0,0 +1,14 @@ +--- +name: PR commented + +# yamllint disable-line rule:truthy +on: + issue_comment: + types: + - created + +jobs: + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_slash_ops_comment_dispatch_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 2a2c004..5def712 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -6,11 +6,7 @@ on: pull_request: jobs: - cspell: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - uses: streetsidesoftware/cspell-action@ca4bb065dd09aca9c90c935f7dc9bb625985226c # v6.1.0 - with: - config: .config/cspell.json + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_spelling_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index b782c47..628eab5 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -7,18 +7,7 @@ on: - cron: "25 2 * * *" jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 - with: - # yamllint disable rule:line-length - stale-issue-message: "This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days." - stale-pr-message: "This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days." - close-issue-message: "This issue was closed because it has been stalled for 10 days with no activity." - close-pr-message: "This PR was closed because it has been stalled for 10 days with no activity." - # yamllint enable rule:line-length - days-before-stale: 30 - days-before-close: 10 - stale-issue-label: "stale" - stale-pr-label: "stale" + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_stale_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit diff --git a/.github/workflows/welcome-message.yml b/.github/workflows/welcome-message.yml deleted file mode 100644 index c286034..0000000 --- a/.github/workflows/welcome-message.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: PR opened - -# yamllint disable-line rule:truthy -on: - pull_request_target: - types: - - opened - -jobs: - add-welcome-message: - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - # yamllint disable rule:line-length - script: | - // adds a comment to the PR (there is the issue API only which works work PRs too) - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Hey @${{ github.event.pull_request.user.login }}! 👋\n\nThank you for your contribution to the project. Please refer to the [contribution rules](../blob/main/CONTRIBUTING.md) for a quick overview of the process.\n\nMake sure that this PR clearly explains:\n\n- the problem being solved\n- the best way a reviewer and you can test your changes\n\nWith submitting this PR you confirm that you hold the rights of the code added and agree that it will published under this [LICENSE](../blob/main/LICENSE).\n\nThe following ChatOps commands are supported:\n- `/help`: notifies a maintainer to help you out\n\nSimply add a comment with the command in the first line. If you need to pass more information, separate it with a blank line from the command.\n\n_This message was generated automatically. You are welcome to [improve it](../blob/main/.github/workflows/welcome-message.yml)._' - }) - # yamllint enable rule:line-length diff --git a/.github/workflows/welcome_message.yml b/.github/workflows/welcome_message.yml new file mode 100644 index 0000000..ac947c3 --- /dev/null +++ b/.github/workflows/welcome_message.yml @@ -0,0 +1,14 @@ +--- +name: PR opened + +# yamllint disable-line rule:truthy +on: + pull_request_target: + types: + - opened + +jobs: + default: + # yamllint disable-line rule:line-length + uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_welcome_message_callable.yml@31e83cf3419b7230171cea9cd2e97f83bc04488f # 1.3.25 + secrets: inherit