mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-17 10:09:05 +02:00
70 lines
2.2 KiB
YAML
70 lines
2.2 KiB
YAML
name: Validate Pull Request
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
- labeled
|
|
- unlabeled
|
|
- edited
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
required-labels-missing:
|
|
name: required labels missing
|
|
runs-on: ubuntu-slim
|
|
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
|
|
&& exit 1
|
|
title:
|
|
name: check title prefix
|
|
runs-on: ubuntu-slim
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: 'false'
|
|
|
|
- name: check
|
|
run: |
|
|
PR_TITLE_PREFIX="${PR_TITLE%%:*}"
|
|
SCOPED_PREFIX_PATTERN='^([^():]+)\(.*\)(:|$)'
|
|
if [[ "$PR_TITLE" =~ $SCOPED_PREFIX_PATTERN ]]; then
|
|
PR_TITLE_PREFIX="${BASH_REMATCH[1]}"
|
|
fi
|
|
|
|
for directory in internal/collector internal pkg .; do
|
|
if [[ -d "$directory/$PR_TITLE_PREFIX" ]]; then
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
case "$PR_TITLE_PREFIX" in
|
|
docs|ci|revert|fix|feat|chore|mixin|main|'*'|Release*|'Synchronize common files from prometheus/prometheus'|'[0.'*|'[1.'*)
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
echo "PR title must start with a package name or an allowed prefix, optionally followed by a scope"
|
|
echo "Examples: 'logical_disk: description', 'mixin(dashboard): description', 'chore(github-action): description'"
|
|
exit 1
|
|
env:
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|