diff --git a/.github/workflows/charts-auto-generate-docs.yaml b/.github/workflows/charts-auto-generate-docs.yaml index 8d54839b..88086b4a 100644 --- a/.github/workflows/charts-auto-generate-docs.yaml +++ b/.github/workflows/charts-auto-generate-docs.yaml @@ -2,6 +2,8 @@ name: "Charts: Auto-generate docs" on: workflow_dispatch: + repository_dispatch: + types: [update-readme-command] pull_request: paths: - 'charts/**/Chart.yaml' @@ -14,8 +16,14 @@ concurrency: cancel-in-progress: true jobs: - generate-readme: - if: "!contains(github.event.head_commit.message, '[ci-skip]') && github.actor != 'k8s-at-home[bot]'" + # Branch-based pull request / workflow_dispatch + generate-readme-trusted: + if: + ( + github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository + ) || + github.event_name == 'workflow_dispatch' name: Auto-generate chart README runs-on: ubuntu-20.04 steps: @@ -81,7 +89,8 @@ jobs: echo "" done - - name: Update Pull Request + - name: Create commit + if: steps.filter.outputs.addedOrModified == 'true' uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Auto-generate chart README diff --git a/.github/workflows/charts-lint-test.yaml b/.github/workflows/charts-lint-test.yaml index c85ff6c1..daa48ddd 100644 --- a/.github/workflows/charts-lint-test.yaml +++ b/.github/workflows/charts-lint-test.yaml @@ -15,7 +15,6 @@ concurrency: jobs: changes-lint: - if: "!contains(github.event.head_commit.message, '[ci-skip]')" name: Detect changes for linting runs-on: ubuntu-20.04 outputs: @@ -51,7 +50,6 @@ jobs: fi changes-install: - if: "!contains(github.event.head_commit.message, '[ci-skip]')" name: Detect changes for install runs-on: ubuntu-20.04 outputs: @@ -89,7 +87,8 @@ jobs: lint: needs: - changes-lint - if: "!contains(github.event.head_commit.message, '[ci-skip]') && needs.changes-lint.outputs.detected == 'true'" + if: + needs.changes-lint.outputs.detected == 'true' name: Lint charts runs-on: ubuntu-20.04 steps: @@ -117,7 +116,6 @@ jobs: unittest: needs: - lint - if: "!contains(github.event.head_commit.message, '[ci-skip]')" name: Run unit tests runs-on: ubuntu-20.04 steps: @@ -153,7 +151,8 @@ jobs: needs: - changes-install - lint - if: "!contains(github.event.head_commit.message, '[ci-skip]') && needs.changes-install.outputs.detected == 'true'" + if: + needs.changes-install.outputs.detected == 'true' name: Install charts strategy: matrix: ${{ fromJson(needs.changes-install.outputs.matrix) }} @@ -200,5 +199,5 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check install matrix status - if: ${{ !contains(github.event.head_commit.message, '[ci-skip]') && needs.changes-install.outputs.detected == 'true' && needs.install.result != 'success' }} + if: ${{ needs.changes-install.outputs.detected == 'true' && needs.install.result != 'success' }} run: exit 1 diff --git a/.github/workflows/charts-release.yaml b/.github/workflows/charts-release.yaml index 175616a9..9defd01f 100644 --- a/.github/workflows/charts-release.yaml +++ b/.github/workflows/charts-release.yaml @@ -17,7 +17,6 @@ on: jobs: release: - if: "!contains(github.event.head_commit.message, '[ci-skip]')" runs-on: ubuntu-20.04 steps: - name: Checkout @@ -45,7 +44,6 @@ jobs: CR_SKIP_EXISTING: "true" generate-summary: - if: "!contains(github.event.head_commit.message, '[ci-skip]')" name: Auto-generate charts summary runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/pre-commit-check.yaml b/.github/workflows/pre-commit-check.yaml index 8cfe3afe..f6586ea8 100644 --- a/.github/workflows/pre-commit-check.yaml +++ b/.github/workflows/pre-commit-check.yaml @@ -10,7 +10,6 @@ concurrency: jobs: pre-commit-check: - if: "!contains(github.event.head_commit.message, '[ci-skip]')" name: Run pre-commit checks runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/slash-command-dispatch.yaml b/.github/workflows/slash-command-dispatch.yaml new file mode 100644 index 00000000..7086cd26 --- /dev/null +++ b/.github/workflows/slash-command-dispatch.yaml @@ -0,0 +1,31 @@ +name: Dispatch Commands + +on: + issue_comment: + types: [created] + +jobs: + # If someone with write access comments "/update-readme" on a pull request, emit a repository_dispatch event + update-readme: + runs-on: ubuntu-latest + # Only run for PRs, not issue comments + if: ${{ github.event.issue.pull_request }} + steps: + - name: Generate token + id: generate_token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} + private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} + + - name: Slash Command Dispatch + uses: peter-evans/slash-command-dispatch@v1 + env: + TOKEN: ${{ steps.generate_token.outputs.token }} + with: + token: ${{ env.TOKEN }} # GitHub App installation access token generated above + reaction-token: ${{ secrets.GITHUB_TOKEN }} + issue-type: pull-request + commands: update-readme + named-args: true + permission: write