Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/automatic-pr-labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---

# The workflow template for automatic PR labeler.
# It requires to have a configuration file with labels and conditions to apply them.
# The configuration file should be placed in the .github folder and named auto-labeler-config.yaml.
# Example file can be found there:
# https://github.com/Netcracker/.github/blob/main/config/examples/auto-labeler-config.yaml

name: Automatic PR Labeler

on:
pull_request:
branches: [main]
types:
[opened, reopened, synchronize]

permissions:
contents: read

jobs:
assign-labels:
if: (github.event.pull_request.merged == false) && (github.event.pull_request.user.login != 'dependabot[bot]') && (github.event.pull_request.user.login != 'github-actions[bot]')
permissions:
pull-requests: write
contents: read
issues: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false

- name: "Execute assign labels"
id: action-assign-labels
uses: mauroalderete/action-assign-labels@671a4ca2da0f900464c58b8b5540a1e07133e915 # v1.5.1
with:
pull-request-number: ${{ github.event.pull_request.number }}
github-token: ${{ github.token }}
conventional-commits: "./.github/auto-labeler-config.yaml"
maintain-labels-not-matched: true
apply-changes: ${{ github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id }}

- name: Set labels-next safely
if: ${{ github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id }}
run: |
echo "LABELS_NEXT=$(echo ${STEPS_ACTION_ASSIGN_LABELS_OUTPUTS_LABELS_NEXT} | tr -dc 'a-zA-Z0-9-,')" >> $GITHUB_ENV
env:
STEPS_ACTION_ASSIGN_LABELS_OUTPUTS_LABELS_NEXT: ${{ steps.action-assign-labels.outputs.labels-next }}
- name: "Drop warning if PR from fork"
if: ${{ github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id }}
run: |
{
echo "⚠️ Pull request from fork! ⚠️";
echo "Labels will not be applied to PR. Assign them manually please.";
echo "Labels to assign: '${LABELS_NEXT}'";
} >> "$GITHUB_STEP_SUMMARY"
Loading