CI - Add mainline labels automatically
Signed-off-by: Justin Williams <Justin.Williams@amd.com>
[ROCm/amdsmi commit: 369afa85eb]
Este cometimento está contido em:
cometido por
Arif, Maisam
ascendente
21e32ffe4a
cometimento
94d451bc03
@@ -0,0 +1,46 @@
|
||||
name: Auto Label Mainline PRs
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
|
||||
jobs:
|
||||
add-label:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:16-alpine
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Add label to PRs targeting amd-mainline
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const pr = context.payload.pull_request;
|
||||
const baseBranch = pr.base.ref;
|
||||
|
||||
// Debug information
|
||||
console.log(`Base Branch: ${baseBranch}`);
|
||||
|
||||
// Check if PR is targeting amd-mainline branch
|
||||
const isMainlineTarget = baseBranch === 'amd-mainline';
|
||||
|
||||
if (isMainlineTarget) {
|
||||
// Label to apply
|
||||
const labelToAdd = 'Merge amd-mainline';
|
||||
|
||||
// Try to add the label
|
||||
try {
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: pr.number,
|
||||
labels: [labelToAdd]
|
||||
});
|
||||
console.log(`Added label "${labelToAdd}" to PR #${pr.number}`);
|
||||
} catch (error) {
|
||||
console.error(`Error adding label: ${error.message}`);
|
||||
}
|
||||
} else {
|
||||
console.log('PR does not match criteria for automatic labeling');
|
||||
}
|
||||
Criar uma nova questão referindo esta
Bloquear um utilizador