feat: Add mutating webhook and defaulter for all signal types #7777
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Github Checks | |
on: | |
pull_request_target: | |
branches: | |
- "main" | |
- "release-*" | |
types: | |
- opened | |
- reopened | |
- edited | |
- synchronize | |
- labeled | |
- unlabeled | |
- milestoned | |
workflow_dispatch: | |
jobs: | |
pr-milestone-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for milestone | |
env: | |
MILESTONE: ${{ toJSON(github.event.pull_request.milestone) }} | |
run: | | |
echo "${MILESTONE}" | jq -e '.!=null' || (echo "Milestone is not set"; exit 1) | |
pr-label-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for area label | |
if: always() | |
run: | | |
gh api --jq '.labels.[].name' /repos/${{ github.repository }}/pulls/${{ github.event.number }} | \ | |
grep -q '^area\/' || (echo "area label missing"; exit 1) | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Check for kind label | |
if: always() | |
run: | | |
gh api --jq '.labels.[].name' /repos/${{ github.repository }}/pulls/${{ github.event.number }} | \ | |
grep -q '^kind\/' || (echo "kind label missing"; exit 1) | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Check if kind label matches pr title prefix | |
if: always() | |
run: | | |
kind_label=$( gh api --jq '.labels.[].name' /repos/${{ github.repository }}/pulls/${{ github.event.number }} | grep '^kind/') | |
kind_label_to_pr_title_prefix='{"kind/bug":"fix","kind/feature":"feat","kind/docs":"docs","kind/chore":"chore","kind/flaky-test":"test","kind/missing-test":"test","kind/failing-test":"test","kind/deps":"deps"}' | |
prefix=$(echo $kind_label_to_pr_title_prefix | jq -r ".\"$kind_label\"") | |
echo "${{ github.event.pull_request.title }}" | grep '^'$prefix || (echo "PR title should start with $prefix"; exit 1) | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Check that there is no do-not-merge label | |
if: always() | |
run: | | |
labels=$(gh api --jq '.labels.[]' /repos/${{ github.repository }}/pulls/${{ github.event.number }} ) | |
echo "Labels found: $( echo $labels | jq -r '.name' )" | |
! echo "$labels" | jq 'select(.name | startswith("do-not-merge"))' | jq -n "input.name" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
pr-title-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Validate title | |
uses: amannn/action-semantic-pull-request@47b15d52c5c30e94a17ec87eb8dd51ff5221fed9 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
types: | | |
deps | |
chore | |
docs | |
feat | |
fix | |
test | |
requireScope: false | |
subjectPattern: ^([A-Z].*[^.]|bump .*)$ | |
pr-prevent-kustomization: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.base.ref == 'main' }} | |
steps: | |
- name: Check-out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- name: Check kustomization.yaml changes | |
uses: tj-actions/changed-files@6b2903bdce6310cfbddd87c418f253cf29b2dec9 | |
id: changed-kustomization | |
with: | |
files: "config/manager/kustomization.yaml" | |
- name: Prevent kustomization.yaml changes | |
run: | | |
if ${{ steps.changed-kustomization.outputs.any_changed }}; then | |
echo "kustomization.yaml file changed!" | |
exit 1 | |
fi |