Skip to content

[rhoai-3.6-ea.1] Record pass-through header names on the process-batch span #21079

[rhoai-3.6-ea.1] Record pass-through header names on the process-batch span

[rhoai-3.6-ea.1] Record pass-through header names on the process-batch span #21079

Workflow file for this run

name: Auto-label PRs
on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
permissions:
contents: read
pull-requests: write
jobs:
title-and-labels:
if: github.repository == 'llm-d/llm-d-batch-gateway' && github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Validate PR title
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6
id: pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
enh
fix
docs
deps
ci
chore
refactor
test
perf
style
revert
build
- name: Apply PR labels
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
env:
PR_TYPE: ${{ steps.pr_title.outputs.type }}
with:
script: |
const fs = require('fs');
const os = require('os');
const path = require('path');
const { data } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: '.github/scripts/detect-pr-label.js',
ref: context.payload.pull_request.base.sha,
});
const scriptPath = path.join(os.tmpdir(), 'detect-pr-label.js');
fs.writeFileSync(scriptPath, Buffer.from(data.content, 'base64').toString());
const { labelFromType, MANAGED_CATEGORY_LABELS } = require(scriptPath);
const type = process.env.PR_TYPE;
const title = context.payload.pull_request.title;
const category = labelFromType(type, title);
const { data: issue } = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const currentLabels = issue.labels.map((label) => label.name);
for (const label of MANAGED_CATEGORY_LABELS) {
if (label !== category && currentLabels.includes(label)) {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: label,
});
}
}
if (category && !currentLabels.includes(category)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: [category],
});
}