[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: on:
workflow_dispatch: workflow_dispatch:
repository_dispatch:
types: [update-readme-command]
pull_request: pull_request:
paths: paths:
- 'charts/**/Chart.yaml' - 'charts/**/Chart.yaml'
@ -14,8 +16,14 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
generate-readme: # Branch-based pull request / workflow_dispatch
if: "!contains(github.event.head_commit.message, '[ci-skip]') && github.actor != 'k8s-at-home[bot]'" 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 name: Auto-generate chart README
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -81,7 +89,8 @@ jobs:
echo "" echo ""
done done
- name: Update Pull Request - name: Create commit
if: steps.filter.outputs.addedOrModified == 'true'
uses: stefanzweifel/git-auto-commit-action@v4 uses: stefanzweifel/git-auto-commit-action@v4
with: with:
commit_message: Auto-generate chart README commit_message: Auto-generate chart README

View File

@ -15,7 +15,6 @@ concurrency:
jobs: jobs:
changes-lint: changes-lint:
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
name: Detect changes for linting name: Detect changes for linting
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
outputs: outputs:
@ -51,7 +50,6 @@ jobs:
fi fi
changes-install: changes-install:
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
name: Detect changes for install name: Detect changes for install
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
outputs: outputs:
@ -89,7 +87,8 @@ jobs:
lint: lint:
needs: needs:
- changes-lint - 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 name: Lint charts
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -117,7 +116,6 @@ jobs:
unittest: unittest:
needs: needs:
- lint - lint
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
name: Run unit tests name: Run unit tests
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -153,7 +151,8 @@ jobs:
needs: needs:
- changes-install - changes-install
- lint - 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 name: Install charts
strategy: strategy:
matrix: ${{ fromJson(needs.changes-install.outputs.matrix) }} matrix: ${{ fromJson(needs.changes-install.outputs.matrix) }}
@ -200,5 +199,5 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Check install matrix status - 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 run: exit 1

View File

@ -17,7 +17,6 @@ on:
jobs: jobs:
release: release:
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout - name: Checkout
@ -45,7 +44,6 @@ jobs:
CR_SKIP_EXISTING: "true" CR_SKIP_EXISTING: "true"
generate-summary: generate-summary:
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
name: Auto-generate charts summary name: Auto-generate charts summary
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:

View File

@ -10,7 +10,6 @@ concurrency:
jobs: jobs:
pre-commit-check: pre-commit-check:
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
name: Run pre-commit checks name: Run pre-commit checks
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: 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