microsoft / microsoft/ebpf-for-windows
"Workflow failed" bugs should be filed with Type Bug instead of Label bug
- Dominant language
- C
- Stars
- 3.6k
- Forks
- 311
- Avg merge
- 6d 10h
- Merged PRs (30d)
- 21
Description
### Describe the feature you'd like supported
Now that Type=Bug exists and we are using it for other issues, we should do the same for "Workflow failed" issues.
reusable-test.yml and netperf.ymp currently file such issues using "bug" in the Labels.
According to Bing copilot:
> GitHub does not expose Project v2 fields through the REST API.
You must use GraphQL.
### Proposed solution
Bing copilot suggests something along the lines of:
```
- uses: actions/github-script@v7
with:
script: |
const { graphql } = github;
// 1. Get project ID
const project = await graphql(`
query {
repository(owner: "${context.repo.owner}", name: "${context.repo.repo}") {
projectsV2(first: 10) {
nodes {
id
title
}
}
}
}
`);
const projectId = project.repository.projectsV2.nodes
.find(p => p.title === "YOUR PROJECT NAME").id;
// 2. Get field ID for "Type"
const fields = await graphql(`
query {
node(id: "${projectId}") {
... on ProjectV2 {
fields(first: 20) {
nodes {
id
name
dataType
options {
id
name
}
}
}
}
}
}
`);
const typeField = fields.node.fields.nodes.find(f => f.name === "Type");
const bugOption = typeField.options.find(o => o.name === "Bug");
// 3. Add issue to project
const item = await graphql(`
mutation {
addProjectV2ItemById(input: {
projectId: "${projectId}",
contentId: "${context.payload.issue.node_id}"
}) {
item {
id
}
}
}
`);
const itemId = item.addProjectV2ItemById.item.id;
// 4. Set Type = Bug
await graphql(`
mutation {
updateProjectV2ItemFieldValue(input: {
projectId: "${projectId}",
itemId: "${itemId}",
fieldId: "${typeField.id}",
value: { singleSelectOptionId: "${bugOption.id}" }
}) {
projectV2Item {
id
}
}
}
`);
```
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.