Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

CI 🤖:
CI🤖:
- changed-files:
- any-glob-to-any-file: ".github/**"

Expand Down
27 changes: 24 additions & 3 deletions .github/workflows/auto-add-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
with:
repo-token: ${{ secrets.SYS_ORCH_GITHUB }}
- name: "Push labels"
id: labeler
uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
- name: "Push labels to PR title"
if: steps.labeler.outputs.all-labels != ''
shell: bash
run: |
valid_labels="CI🤖|root|infra-core|infra-external|infra-manager|infra-onboarding"

labels=$(echo "${{ steps.labeler.outputs.all-labels }}" | grep -oE "$valid_labels" | tr '\n' ',' | sed 's/,$//')
old_pr_title="${{ github.event.pull_request.title }}"
new_pr_title=$(echo "$old_pr_title" | sed -n 's/ *\[\([^]]*\)\]$//p')
if [ -z "$new_pr_title" ]; then
new_pr_title="$old_pr_title"
fi
new_pr_title="${new_pr_title} [$labels]"
echo "Labels: $labels"
echo "Old PR title: $old_pr_title"
echo "New PR title: $new_pr_title"
curl -s -X PATCH \
-H "Authorization: Bearer ${{ secrets.SYS_ORCH_GITHUB }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" \
-d '{"title": "'"$new_pr_title"'"}' > /dev/null
Loading