mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[bot] Add quantization triage bot script (#45622)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/45622 Copied and modified from https://github.com/pytorch/pytorch/blob/master/.github/workflows/jit_triage.yml Test Plan: Imported from OSS Reviewed By: raghuramank100 Differential Revision: D24036142 fbshipit-source-id: 41287b6a0390cabe4474c99464d74da2c0934401
This commit is contained in:
parent
869b05648d
commit
0b3ad5404a
78
.github/workflows/quantization_triage.yml
vendored
Normal file
78
.github/workflows/quantization_triage.yml
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
name: quantization-triage
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
|
||||
jobs:
|
||||
welcome:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v2
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
// Arguments available:
|
||||
// - github: A pre-authenticated octokit/rest.js client
|
||||
// - context: An object containing the context of the workflow run
|
||||
// - core: A reference to the @actions/core package
|
||||
// - io: A reference to the @actions/io package
|
||||
|
||||
// Check if issue has a Quantization label.
|
||||
const kQuantizationLabel = "oncall: quantization";
|
||||
|
||||
issue = await github.issues.get({
|
||||
owner: context.issue.owner,
|
||||
repo: context.issue.repo,
|
||||
issue_number: context.issue.number,
|
||||
})
|
||||
|
||||
const hasQuantizationLabel = issue.data.labels.filter(label => label.name == kQuantizationLabel).length > 0;
|
||||
|
||||
if (!hasQuantizationLabel) {
|
||||
core.debug("Issue " + issue.data.title + " does not have Quantization label");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get project column ID.
|
||||
const kProjectName = "Quantization Triage";
|
||||
const kColumnName = "Need Triage";
|
||||
|
||||
// Query all projects in the repository.
|
||||
// TODO: Support pagination once there are > 30 projects.
|
||||
const projects = await github.projects.listForRepo({
|
||||
owner: context.issue.owner,
|
||||
repo: context.issue.repo,
|
||||
});
|
||||
|
||||
// Filter out unwanted projects and get the ID for the Quantization Triage project.
|
||||
const filteredProjects = projects.data.filter(project => project.name == kProjectName);
|
||||
|
||||
if (filteredProjects.length != 1) {
|
||||
core.setFailed("Unable to find a project named " + kProjectName);
|
||||
return;
|
||||
}
|
||||
|
||||
const projectId = filteredProjects[0].id;
|
||||
// First, query all columns in the project.
|
||||
// TODO: Support pagination once there are > 30 columns.
|
||||
const columns = await github.projects.listColumns({
|
||||
project_id: projectId,
|
||||
});
|
||||
|
||||
// Filter out unwanted projects and get the ID for the Need triage column.
|
||||
const filteredColumns = columns.data.filter(column => column.name == kColumnName);
|
||||
|
||||
if (filteredColumns.length != 1) {
|
||||
core.setFailed("Unable to find a column named " + kColumnName);
|
||||
return;
|
||||
}
|
||||
|
||||
const columnId = filteredColumns[0].id;
|
||||
|
||||
// Create a project card for this new issue.
|
||||
await github.projects.createCard({
|
||||
column_id: columnId,
|
||||
content_id: issue.data.id,
|
||||
content_type: "Issue",
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user