67 lines
2.1 KiB
YAML
67 lines
2.1 KiB
YAML
name: Required labels
|
|
description: >-
|
|
Fail unless a pull request carries the required labels (names or regular
|
|
expressions). Reads the pull request's labels from the event payload, so it
|
|
needs no API token and behaves the same on GitHub Actions and Gitea Actions.
|
|
author: Kosmos
|
|
branding:
|
|
icon: tag
|
|
color: blue
|
|
|
|
inputs:
|
|
labels:
|
|
description: >-
|
|
Required labels, one per line or comma-separated. Each entry is matched
|
|
against the pull request's labels; with `use-regex: true` each entry is a
|
|
regular expression. Empty, or the literal "disabled", makes the check pass.
|
|
required: false
|
|
default: ""
|
|
mode:
|
|
description: "How to compare: any (at least one), all, or exactly."
|
|
required: false
|
|
default: "any"
|
|
count:
|
|
description: "Number of labels required when mode is exactly."
|
|
required: false
|
|
default: "1"
|
|
use-regex:
|
|
description: "Treat each entry in `labels` as a regular expression."
|
|
required: false
|
|
default: "false"
|
|
message:
|
|
description: "Extra text appended to the failure output."
|
|
required: false
|
|
default: ""
|
|
draft-passes:
|
|
description: >-
|
|
When true (default), draft ("WIP") pull requests always pass, so the check
|
|
only fails once the pull request is ready for review.
|
|
required: false
|
|
default: "true"
|
|
|
|
outputs:
|
|
labels:
|
|
description: "The required entries that matched, comma-separated."
|
|
value: ${{ steps.check.outputs.labels }}
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- id: check
|
|
shell: bash
|
|
env:
|
|
RL_LABELS: ${{ inputs.labels }}
|
|
RL_MODE: ${{ inputs.mode }}
|
|
RL_COUNT: ${{ inputs.count }}
|
|
RL_USE_REGEX: ${{ inputs.use-regex }}
|
|
RL_MESSAGE: ${{ inputs.message }}
|
|
RL_DRAFT_PASSES: ${{ inputs.draft-passes }}
|
|
# Used to read the current labels from the forge API. The event payload
|
|
# is unreliable for label add/remove events on Gitea.
|
|
RL_API_URL: ${{ github.api_url }}
|
|
RL_REPOSITORY: ${{ github.repository }}
|
|
RL_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
RL_TOKEN: ${{ github.token }}
|
|
run: |
|
|
"${{ github.action_path }}/check.sh"
|