diff --git a/.github/workflows/tagPriorityLow.yml b/.github/workflows/tagPriorityLow.yml index 1901aca3a..69fa4e862 100644 --- a/.github/workflows/tagPriorityLow.yml +++ b/.github/workflows/tagPriorityLow.yml @@ -1,24 +1,28 @@ -name: update low priority items based on ADO query +name: tag low priority issues on: workflow_dispatch: +permissions: + issues: write + jobs: - update-low-priority-items: + tag-low-priority-issues: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '20.x' - run: npm install azure-devops-node-api - uses: actions/github-script@v7 env: ado_token: '${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}' - query_id: '${{ secrets.ADO_QUERY_ID }}' + query_id: '6777cf01-7065-42ca-99ca-ba0d7b77d8fd' with: script: | const azdev = require('azure-devops-node-api') - + + // Get the ADO client try { const orgUrl = "https://dev.azure.com/microsoft"; const adoAuthHandler = azdev.getPersonalAccessTokenHandler(process.env.ado_token); @@ -30,5 +34,53 @@ jobs: return; } + // Querying Lastest Work Items const queryResult = await adoClient.queryById(process.env.query_id); - console.log(queryResult); + + // Iterate over work items, including relations + // https://github.com/microsoft/azure-devops-node-api/blob/master/api/interfaces/WorkItemTrackingInterfaces.ts#L1485 + const workItemsDetails = await adoClient.getWorkItems(queryResult.workItems.map(wi => wi.id), null, null, 1); + + // Obtain GitHub Issue Number + function getGitHubIssueNumber(workItem) { + + // Try using relations + const relation = workItem.relations.find(r => r.rel === 'Hyperlink' && r.url.includes('github.com')); + if (relation) { + const match = relation.url.match(/github.com\/[^/]+\/[^/]+\/issues\/(\d+)/); + if (match) { + return match[1]; + } + } + + // Try using the title, which includes [GitHub #123] + const match = workItem.fields['System.Title'].match(/\[GitHub #(\d+)\]/); + if (match) { + return match[1]; + } + + return null; + } + + // Map ADO work items to GitHub number, remove nulls + const ghIssueNumbers = workItemsDetails.map(wi => getGitHubIssueNumber(wi)).filter(n => n !== null); + + // Add priority-low label to GitHub issues + const addLowPriorityLabel = async (issueNumber) => { + await github.rest.issues.addLabels({ + issue_number: issueNumber, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['priority-low'] + }); + } + + ghIssueNumbers.forEach(async (issueNumber) => { + await addLowPriorityLabel(issueNumber); + }); + + core.setOutput('Tagged Issues', ghIssueNumbers.join(',')); + + + + diff --git a/README.md b/README.md index a9622f7a6..ca1afe44a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,16 @@ + + # Microsoft Edge WebView2 Welcome to Microsoft Edge WebView2 feedback repository. @@ -20,14 +33,23 @@ This is a place for all developers of the [Microsoft Edge WebView2](https://aka. 1. [Search for existing open bugs](https://github.com/MicrosoftEdge/WebView2Feedback/issues?q=is%3Aissue+is%3Aopen+label%3Abug) to avoid duplicates. 1. If you find that your bug is already reported, give it a 👍 reaction, and add a comment with additional details that may help us investigate. 1. If the issue is not already reported, [open a new issue](https://github.com/MicrosoftEdge/WebView2Feedback/issues/new/choose). -1. Tracked issues will be labeled with the `tracked` label. If you see this label, we are aware of the issue and tracking it on our internal backlog. +1. Tracked issues will be labeled with the tracked label. If you see this label, we are aware of the issue and tracking it on our internal backlog. ### 💡 How to request a feature 1. [Search for existing feature request](https://github.com/MicrosoftEdge/WebView2Feedback/issues?q=is%3Aissue+is%3Aopen+label%3A%22feature+request%22) to avoid duplicates. 1. If you find a similar feature request, give it a 👍 reaction, and provide additional context into how you would use the feature. 2. If the feature is not already requested, [open a new issue](https://github.com/MicrosoftEdge/WebView2Feedback/issues/new/choose). -1. Tracked issues will be labeled with the `tracked` label. If you see this label, we are aware of the issue and tracking it on our internal backlog. +1. Tracked issues will be labeled with the tracked label. If you see this label, we are aware of the issue and tracking it on our internal backlog. + + +### What do the labels on the issues mean? + +- tracked We have acknowledged the issue and are tracking it on our internal backlog. We will consider and investigate them in the near future. + - For bugs, it means we think this is an actual product issue. + - For feature requests, it means we consider it to be a valid request. +- regression A behavior that used to work in a previous version of WebView2, but no longer works as expected. We will prioritize this issue higher. +- priority-low We have considered this issue and decided that we will not be able to address it in the near future. Developers are welcomed to provide justifications on this issue for us to revisit the prioritization. ## Code of Conduct This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.