Skip to content

Commit 357dd8e

Browse files
authored
Merge pull request #630 from gardar/ci/fix-role-labeling
skip_changelog(ci): fix changed role detection script
2 parents 320d762 + ecddcd3 commit 357dd8e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/conventional-label.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,23 @@ jobs:
5555
if: github.event.pull_request.labels.length == 0
5656
steps:
5757
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
58+
with:
59+
fetch-depth: 0
5860

5961
- name: Get changed roles
6062
id: changed-roles
61-
run: git diff --name-only ${{ github.event.pull_request.head.sha }} -r | grep -E '^roles/' | cut -f 1-2 -d'/' | sort -u >> "$GITHUB_OUTPUT"
63+
env:
64+
BASE_REF: ${{ github.event.pull_request.base.ref }}
65+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
66+
run: |
67+
files="$(git diff --name-only "origin/${BASE_REF}...origin/${HEAD_REF}" \
68+
| grep -E '^roles/' \
69+
| cut -f 1-2 -d'/' \
70+
| sort -u \
71+
| tr '\n' ' ' \
72+
| sed 's/[[:space:]]*$//')"
73+
74+
echo "all_changed_and_modified_files=${files}" >> "$GITHUB_OUTPUT"
6275
6376
- name: Add changed roles labels
6477
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1

0 commit comments

Comments
 (0)