aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Blinkov <ivan@ydb.tech>2024-01-17 00:24:06 -0800
committerGitHub <noreply@github.com>2024-01-17 09:24:06 +0100
commit5173c3f829827c1490ed97f6358176fe6ff67a3e (patch)
tree2b54779ee694bfd51aadd0cd273728d595ed6e94
parentac85ffbb04b6af85629707526bc8f0fbe2587612 (diff)
downloadydb-5173c3f829827c1490ed97f6358176fe6ff67a3e.tar.gz
Create pr_labels.yaml (#1033)
-rw-r--r--.github/workflows/pr_labels.yaml49
1 files changed, 49 insertions, 0 deletions
diff --git a/.github/workflows/pr_labels.yaml b/.github/workflows/pr_labels.yaml
new file mode 100644
index 0000000000..60bb3db082
--- /dev/null
+++ b/.github/workflows/pr_labels.yaml
@@ -0,0 +1,49 @@
+name: PR-labels
+on:
+ pull_request_target:
+ branches:
+ - 'main'
+ types:
+ - 'opened'
+ - 'edited'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+jobs:
+ update-labels:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Update PR labels
+ id: update-pr-labels
+ uses: actions/github-script@v6
+ with:
+ github-token: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
+ script: |
+ const { owner, repo } = context.repo;
+ const prNumber = context.payload.pull_request.number;
+ const description = context.payload.pull_request.body;
+ const mapping = [
+ ['* New feature', 'new-feature'],
+ ['* Experimental feature', 'experimental-feature'],
+ ['* Improvement', 'improvement'],
+ ['* Performance improvement', 'performance'],
+ ['* Bugfix', 'bugfix'],
+ ['* Backward incompatible change', 'backward-incompatible'],
+ ['* Documentation', 'documentation'],
+ ['* Not for changelog', 'not-for-changelog']
+ ];
+ for (let pair of mapping) {
+ if (!description.includes(pair[0])) continue;
+ try {
+ const result = await github.rest.issues.addLabels({
+ owner,
+ repo,
+ issue_number: prNumber,
+ labels: [pair[1]]
+ });
+ console.log('Added label', pair[1]);
+ } catch(e) {
+ console.log(e);
+ }
+ return;
+ }