[ci] Better workflow (#991)

* [ci] Better workflow
* Remove skip checks, those are native now

Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2021-06-12 09:07:32 +02:00 committed by GitHub
parent 656b00cd34
commit e062593a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -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