2024-07-29 16:04:08 +00:00
|
|
|
name: Validate Pull Request
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types:
|
|
|
|
- opened
|
|
|
|
- reopened
|
|
|
|
- synchronize
|
|
|
|
- labeled
|
|
|
|
- unlabeled
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
required-labels-missing:
|
|
|
|
name: required labels missing
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: check
|
|
|
|
if: >-
|
|
|
|
!contains(github.event.pull_request.labels.*.name, '💥 breaking-change')
|
|
|
|
&& !contains(github.event.pull_request.labels.*.name, '✨ enhancement')
|
|
|
|
&& !contains(github.event.pull_request.labels.*.name, '🐞 bug')
|
|
|
|
&& !contains(github.event.pull_request.labels.*.name, '📖 docs')
|
|
|
|
&& !contains(github.event.pull_request.labels.*.name, 'chore')
|
|
|
|
&& !contains(github.event.pull_request.labels.*.name, '🛠️ dependencies')
|
|
|
|
run: >-
|
|
|
|
echo One of the following labels is missing on this PR:
|
|
|
|
breaking-change
|
|
|
|
enhancement
|
|
|
|
bug
|
|
|
|
docs
|
|
|
|
chore
|
2024-07-31 13:02:29 +00:00
|
|
|
&& exit 1
|
|
|
|
title:
|
|
|
|
name: check title prefix
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-08-05 13:57:10 +00:00
|
|
|
- uses: actions/checkout@v4
|
2024-07-31 13:02:29 +00:00
|
|
|
- name: check
|
|
|
|
run: |
|
|
|
|
PR_TITLE_PREFIX=$(echo "$PR_TITLE" | cut -d':' -f1)
|
2024-10-10 19:06:37 +00:00
|
|
|
if [[ -d "internal/collector/$PR_TITLE_PREFIX" ]] || [[ -d "internal/$PR_TITLE_PREFIX" ]] || [[ -d "pkg/$PR_TITLE_PREFIX" ]] || [[ -d "$PR_TITLE_PREFIX" ]] || [[ "$PR_TITLE_PREFIX" == "docs" ]] || [[ "$PR_TITLE_PREFIX" == "ci" ]] || [[ "$PR_TITLE_PREFIX" == "revert" ]] || [[ "$PR_TITLE_PREFIX" == "fix" ]] || [[ "$PR_TITLE_PREFIX" == "chore" ]] || [[ "$PR_TITLE_PREFIX" == "chore(docs)" ]] || [[ "$PR_TITLE_PREFIX" == "chore(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "*" ]] || [[ "$PR_TITLE_PREFIX" == "Synchronize common files from prometheus/prometheus" ]]; then
|
2024-08-05 13:50:41 +00:00
|
|
|
exit 0
|
2024-07-31 13:02:29 +00:00
|
|
|
fi
|
2024-08-05 13:50:41 +00:00
|
|
|
|
|
|
|
echo "PR title must start with an name of an collector package"
|
|
|
|
echo "Example: 'logical_disk: description'"
|
|
|
|
exit 1
|
2024-07-31 13:02:29 +00:00
|
|
|
env:
|
2024-08-05 11:28:39 +00:00
|
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|