Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .github/component_owners.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# this file is used by .github/workflows/assign-reviewers.yml
# this file is used by .github/workflows/assign-reviewers.yml and .github/workflows/assign-issue-owners.yml
#
# NOTE component owners must be members of the GitHub OpenTelemetry organization
# so that they can be added to @open-telemetry/java-contrib-triagers
# which in turn is required for them to be auto-assigned as reviewers by the automation
# which in turn is required for them to be auto-assigned as reviewers and issue assignees by the automation
#
# NOTE when updating this file, don't forget to update the README.md files in the associated
# components also
#
# NOTE when adding/updating one of the component names, don't forget to update the associated
# `comp:*` labels
# `component:*` labels (used for both PR reviews and issue assignment)
components:
aws-resources:
- wangzlei
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/assign-issue-owners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
name: Assign issue owners

on:
issues:
types: [labeled]

permissions:
contents: read

jobs:
assign-owners:
permissions:
contents: read
issues: write
runs-on: ubuntu-latest
if: startsWith(github.event.label.name, 'component:')
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Parse component label and assign owners
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const fs = require('fs');
const yaml = require('js-yaml');

// Extract component name from label
const labelName = context.payload.label.name;

if (!labelName.startsWith('component:')) {
core.setFailed('Label does not match expected pattern');
return;
}

const componentName = labelName.replace('component:', '');
console.log(`Processing component: ${componentName}`);

// Read and parse component_owners.yml
const yamlContent = fs.readFileSync('.github/component_owners.yml', 'utf8');
const data = yaml.load(yamlContent);

if (!data || !data.components) {
core.setFailed('Invalid component_owners.yml structure');
return;
}

const components = data.components;

if (!(componentName in components)) {
core.setFailed(`Component '${componentName}' not found in component_owners.yml`);
return;
}

const owners = components[componentName];

if (!owners || owners.length === 0) {
core.setFailed(`No owners found for component '${componentName}'`);
return;
}

console.log(`Found owners: ${owners.join(', ')}`);

// Assign the issue to the owners
const issueNumber = context.payload.issue.number;

await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
assignees: owners
});

console.log(`Successfully assigned issue #${issueNumber} to ${owners.join(', ')}`);
Loading