From cfa352711834e0c05cce1db9d5c73c4c2eb8e2b6 Mon Sep 17 00:00:00 2001
From: silverwind <me@silverwind.io>
Date: Thu, 7 Sep 2023 23:30:03 +0200
Subject: [PATCH] Add `actions/labeler` (#26962)

Implements https://github.com/GiteaBot/gitea-backporter/issues/93 using
[`actions/labeler`](https://github.com/actions/labeler). Very basic
configuration, can be extended later.
---
 .github/labeler.yml                | 24 ++++++++++++++++++++++++
 .github/workflows/pull-labeler.yml | 21 +++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 .github/labeler.yml
 create mode 100644 .github/workflows/pull-labeler.yml

diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 0000000000..34713f078e
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,24 @@
+kind/docs:
+  - **/*.md
+  - docs/**/*
+
+kind/ui:
+  - web_src/**/*
+  - all: ["templates/**/*", "!templates/swagger/v1_json.tmpl"]
+
+kind/api:
+  - templates/swagger/v1_json.tmpl
+
+kind/build:
+  - Makefile
+  - Dockerfile
+  - Dockerfile.rootless
+  - docker/**
+  - webpack.config.js
+
+kind/lint:
+  - .eslintrc.yaml
+  - .golangci.yml
+  - .markdownlint.yaml
+  - .spectral.yaml
+  - .stylelintrc.yaml
diff --git a/.github/workflows/pull-labeler.yml b/.github/workflows/pull-labeler.yml
new file mode 100644
index 0000000000..c62142b9d2
--- /dev/null
+++ b/.github/workflows/pull-labeler.yml
@@ -0,0 +1,21 @@
+name: labeler
+
+on:
+  pull_request_target:
+    types: [opened, synchronize, reopened]
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
+  cancel-in-progress: true
+
+jobs:
+  label:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      pull-requests: write
+    steps:
+      - uses: actions/labeler@v4
+        with:
+          dot: true
+          sync-labels: true