-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12827 from microsoft/seanmcm/1_22_9_release
Merge for 1.22.9
- Loading branch information
Showing
177 changed files
with
7,429 additions
and
7,735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
registry=https://pkgs.dev.azure.com/azure-public/VisualCpp/_packaging/cpp_PublicPackages/npm/registry/ | ||
always-auth=true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { GitHub } from '../api/api'; | ||
import { ActionBase } from '../common/ActionBase'; | ||
import { daysAgoToHumanReadbleDate, daysAgoToTimestamp, safeLog } from '../common/utils'; | ||
|
||
export class AddComment extends ActionBase { | ||
constructor( | ||
private github: GitHub, | ||
private createdAfter: string | undefined, | ||
private afterDays: number, | ||
labels: string, | ||
private addComment: string, | ||
private addLabels?: string, | ||
private removeLabels?: string, | ||
private setMilestoneId?: string, | ||
milestoneName?: string, | ||
milestoneId?: string, | ||
ignoreLabels?: string, | ||
ignoreMilestoneNames?: string, | ||
ignoreMilestoneIds?: string, | ||
minimumVotes?: number, | ||
maximumVotes?: number, | ||
involves?: string | ||
) { | ||
super(labels, milestoneName, milestoneId, ignoreLabels, ignoreMilestoneNames, ignoreMilestoneIds, minimumVotes, maximumVotes, involves); | ||
} | ||
|
||
async run() { | ||
const updatedTimestamp = this.afterDays ? daysAgoToHumanReadbleDate(this.afterDays) : undefined; | ||
const query = this.buildQuery( | ||
(updatedTimestamp ? `updated:<${updatedTimestamp} ` : "") + | ||
(this.createdAfter ? `created:>${this.createdAfter} ` : "") + | ||
"is:open is:unlocked"); | ||
|
||
const addLabelsSet = this.addLabels ? this.addLabels.split(',') : []; | ||
const removeLabelsSet = this.removeLabels ? this.removeLabels.split(',') : []; | ||
|
||
for await (const page of this.github.query({ q: query })) { | ||
for (const issue of page) { | ||
const hydrated = await issue.getIssue(); | ||
if (hydrated.open && this.validateIssue(hydrated) | ||
// TODO: Verify updated timestamp | ||
) { | ||
// Don't add a comment if already commented on by an action. | ||
let foundActionComment = false; | ||
for await (const commentBatch of issue.getComments()) { | ||
for (const comment of commentBatch) { | ||
if (comment.author.isGitHubApp) { | ||
foundActionComment = true; | ||
break; | ||
} | ||
} | ||
if (foundActionComment) | ||
break; | ||
} | ||
if (foundActionComment) { | ||
safeLog(`Issue ${hydrated.number} already commented on by an action. Ignoring.`); | ||
continue; | ||
} | ||
|
||
if (this.addComment) { | ||
safeLog(`Posting comment on issue ${hydrated.number}`); | ||
await issue.postComment(this.addComment); | ||
} | ||
if (removeLabelsSet.length > 0) { | ||
for (const removeLabel of removeLabelsSet) { | ||
if (removeLabel && removeLabel.length > 0) { | ||
safeLog(`Removing label on issue ${hydrated.number}: ${removeLabel}`); | ||
await issue.removeLabel(removeLabel); | ||
} | ||
} | ||
} | ||
if (addLabelsSet.length > 0) { | ||
for (const addLabel of addLabelsSet) { | ||
if (addLabel && addLabel.length > 0) { | ||
safeLog(`Adding label on issue ${hydrated.number}: ${addLabel}`); | ||
await issue.addLabel(addLabel); | ||
} | ||
} | ||
} | ||
if (this.setMilestoneId != undefined) { | ||
safeLog(`Setting milestone of issue ${hydrated.number} to id ${+this.setMilestoneId}`); | ||
await issue.setMilestone(+this.setMilestoneId); | ||
} | ||
safeLog(`Processing issue ${hydrated.number}.`); | ||
} else { | ||
if (!hydrated.open) { | ||
safeLog(`Issue ${hydrated.number} is not open. Ignoring`); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Add Comment and Label | ||
description: Add comment (etc) to issues that are marked with a specified label (etc) | ||
inputs: | ||
token: | ||
description: GitHub token with issue, comment, and label read/write permissions | ||
default: ${{ github.token }} | ||
createdAfter: | ||
description: Creation date after which to be considered. | ||
required: false | ||
afterDays: | ||
description: Days to wait before performing this action (may be 0). | ||
required: false | ||
addComment: | ||
description: Comment to add | ||
labels: | ||
description: items with these labels will be considered. May be "*". | ||
required: true | ||
milestoneName: | ||
description: items with these milestones will be considered (name only, must match ID) | ||
milestoneId: | ||
description: items with these milestones will be considered (id only, must match name) | ||
ignoreLabels: | ||
description: items with these labels will not be considered | ||
ignoreMilestoneNames: | ||
description: items with these milestones will not be considered (names only, must match IDs). May be "*". | ||
ignoreMilestoneIds: | ||
description: items with these milestones will not be considered (IDs only, must match names) | ||
addLabels: | ||
description: Labels to add to issue. | ||
removeLabels: | ||
description: Labels to remove from issue. | ||
minimumVotes: | ||
descriptions: Only issues with at least this many votes will be considered. | ||
maximumVotes: | ||
descriptions: Only issues fewer or equal to this many votes will be considered. | ||
involves: | ||
descriptions: Qualifier to find issues that in some way involve a certain user either as an author, assignee, or mentions. | ||
readonly: | ||
description: If true, changes are not applied. | ||
runs: | ||
using: 'node12' | ||
main: 'index.js' |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { OctoKit } from '../api/octokit' | ||
import { getInput, getRequiredInput } from '../common/utils' | ||
import { AddComment } from './AddComment' | ||
import { Action } from '../common/Action' | ||
|
||
class AddCommentAction extends Action { | ||
id = 'AddComment'; | ||
|
||
async onTriggered(github: OctoKit) { | ||
await new AddComment( | ||
github, | ||
getInput('createdAfter') || undefined, | ||
+(getInput('afterDays') || 0), | ||
getRequiredInput('labels'), | ||
getInput('addComment') || '', | ||
getInput('addLabels') || undefined, | ||
getInput('removeLabels') || undefined, | ||
getInput('setMilestoneId') || undefined, | ||
getInput('milestoneName') || undefined, | ||
getInput('milestoneId') || undefined, | ||
getInput('ignoreLabels') || undefined, | ||
getInput('ignoreMilestoneNames') || undefined, | ||
getInput('ignoreMilestoneIds') || undefined, | ||
+(getInput('minimumVotes') || 0), | ||
+(getInput('maximumVotes') || 9999999), | ||
getInput('involves') || undefined | ||
).run(); | ||
} | ||
} | ||
|
||
new AddCommentAction().run(); // eslint-disable-line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.