Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add dynamic Integrations labeler #844

Closed
wants to merge 10 commits into from
Closed
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
39 changes: 37 additions & 2 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,46 @@ on:
- pull_request_target

jobs:
triage:
labeler:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
- name: Checkout Repo
uses: actions/checkout@v4

- name: Create dynamic labeler configuration
env:
yamlfile: .github/labeler.yml
run: |
find integrations -mindepth 1 -maxdepth 1 -type d | grep -v '/\.' | awk -F'/' '{print $NF}' | jq -R -s -c 'split("\n")[:-1]' > integrations.json
echo "Integrations:"
cat integrations.json
touch ${{ env.yamlfile }}
echo "Add dynamic integration labels to ${{ env.yamlfile }}"
jq -r '.[]' integrations.json | while read integration; do
label="${integration//\//-}"
if [ "${#label}" -gt 63 ]; then
echo "Label is longer than 63 characters: $label"
label="${label:0:63}"
echo "Trimmed label to 63 characters: $label"
fi

echo "- $integration -> $label"

cat >> ${{ env.yamlfile }} << EOF
$label:
- changed-files:
- any-glob-to-any-file: 'integrations/$integration/**'
EOF
done

echo "Output file"
cat ${{ env.yamlfile }}

- name: Apply labels
uses: actions/labeler@v5
with:
sync-labels: true
config-path: .github/labeler.yml
repo-token: "${{ secrets.GITHUB_TOKEN }}"

size-label:
Expand Down