Skip to content

Commit 6d198fe

Browse files
authored
Merge branch 'dev' into supkasar-patch-2
2 parents a46643b + e7482a0 commit 6d198fe

File tree

827 files changed

+31883
-1947
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

827 files changed

+31883
-1947
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
/templates/scripts @hund030 @eriolchan @huimiu
106106
/templates/constraints/yml/actions @hund030 @eriolchan @huimiu
107107

108+
/templates/**/api-plugin-from-scratch @hund030 @eriolchan @huimiu
108109
/templates/**/copilot-plugin-from-scratch @hund030 @eriolchan @huimiu
109110
/templates/**/copilot-plugin-from-scratch-api-key @hund030 @eriolchan @huimiu
110111
/templates/**/dashboard-tab @hund030 @eriolchan @huimiu
@@ -124,6 +125,7 @@
124125
/templates/**/office-addin @jayzhang @nliu-ms
125126
/templates/**/copilot-plugin-existing-api @yuqizhou77 @Alive-Fish @jayzhang
126127
/templates/**/copilot-plugin-existing-api-api-key @yuqizhou77 @Alive-Fish @jayzhang
128+
/templates/**/api-plugin-existing-api @yuqizhou77 @Alive-Fish @jayzhang
127129
/templates/**/spfx-tab @HuihuiWu-Microsoft @yuqizhou77 @nliu-ms @jayzhang
128130
/templates/**/spfx-tab-import @HuihuiWu-Microsoft @yuqizhou77 @nliu-ms @jayzhang
129131

@@ -139,6 +141,10 @@
139141
/templates/**/m365-message-extension @kimizhu @swatDong @kuojianlu
140142
/templates/**/ai-bot @kimizhu @swatDong @kuojianlu
141143
/templates/**/ai-assistant-bot @kimizhu @swatDong @kuojianlu
144+
/templates/**/custom-copilot-basic @kimizhu @swatDong @kuojianlu @XiaofuHuang
145+
/templates/python/custom-copilot-basic @frankqianms @adashen
146+
/templates/**/custom-copilot-assistant-new @kimizhu @swatDong @kuojianlu @XiaofuHuang
147+
/templates/**/custom-copilot-assistant-assistants-api @kimizhu @swatDong @kuojianlu @XiaofuHuang
142148

143149
/packages/fx-core/.eslintignore @LongOddCode @wenytang-ms
144150
/packages/fx-core/.eslintrc.js @LongOddCode @wenytang-ms

.github/actions/create-milestone/index.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ class CreateMilestone extends Action {
2828
for (const sprint of sprints) {
2929
await checkAndCreateMilestone(sprint, existingMilestones);
3030
}
31+
32+
const existingOpenMilestones = await getExistingMilestones('CY', 'open');
33+
safeLog(`found ${existingMilestones.length} existing open milestones`);
34+
for (const openMilestone of existingOpenMilestones) {
35+
await checkAndCloseMilestone(openMilestone);
36+
}
3137
}
3238

3339
private async createClient() {
@@ -93,7 +99,7 @@ async function checkAndCreateMilestone(sprint: any, existingMilestones: any[]):
9399
title: `${prefix}-${name}`,
94100
due_on: new Date(sprint.attributes.finishDate),
95101
path: sprint.path,
96-
}
102+
};
97103
safeLog(`create milestone ${milestoneInfo.title}`);
98104
await createMilestone(milestoneInfo);
99105
}
@@ -118,12 +124,12 @@ async function checkAndCreateMilestone(sprint: any, existingMilestones: any[]):
118124
due_on: string | null;
119125
};
120126
*/
121-
async function getExistingMilestones(prefix: string): Promise<any[]> {
127+
async function getExistingMilestones(prefix: string, state: "open" | "closed" | "all" = "all"): Promise<any[]> {
122128
let resp = await kit.request('GET /repos/{owner}/{repo}/milestones', {
123129
owner: owner,
124130
repo: repo,
125131
direction: 'desc',
126-
state: 'all',
132+
state: state,
127133
per_page: 20,
128134
});
129135
const milestones = resp.data.filter(
@@ -134,3 +140,23 @@ async function getExistingMilestones(prefix: string): Promise<any[]> {
134140
// latestInfo.due_on = new Date(milestones[latestIndex].due_on!);
135141
}
136142

143+
async function checkAndCloseMilestone(milestone: any): Promise<void> {
144+
safeLog(`check ${milestone.title} for close`);
145+
if (milestone.open_issues === 0 && milestone.due_on) {
146+
const dueTime = new Date(milestone.due_on);
147+
if (dueTime < new Date()) {
148+
await kit.request('PATCH /repos/{owner}/{repo}/milestones/{milestone_number}', {
149+
owner: owner,
150+
repo: repo,
151+
milestone_number: milestone.number,
152+
state: 'closed',
153+
headers: {
154+
'X-GitHub-Api-Version': '2022-11-28'
155+
}
156+
});
157+
safeLog(`close dued milestones: ${milestone.title}`);
158+
}
159+
}
160+
161+
}
162+

.github/policies/resourceManagement.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ configuration:
1616
then:
1717
- addReply:
1818
reply: Thank you for contacting us! Any issue or feedback from you is quite important to us. We will do our best to fully respond to your issue as soon as possible. Sometimes additional investigations may be needed, we will usually get back to you within 2 days by adding comments to this issue. Please stay tuned.
19+
- addLabel:
20+
label: needs attention
1921
- description: "[Idle Issue Management] Remove no recent activity label from issues"
2022
if:
2123
- payloadType: Issues

.github/workflows/lint-pr.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,6 @@ jobs:
4343
}
4444
}
4545
46-
npm-audit:
47-
if: ${{ github.event_name != 'pull_request' }}
48-
runs-on: ubuntu-latest
49-
steps:
50-
- uses: actions/checkout@v3
51-
- name: Setup node
52-
uses: actions/setup-node@v3
53-
with:
54-
node-version: 14
55-
- name: audit
56-
run: npx lerna-audit
57-
- name: check cache
58-
run: |
59-
git add .
60-
VAR=$(git diff --cached --name-only)
61-
if [ ! -z "$VAR" ]
62-
then
63-
echo $VAR
64-
echo '======================================= Prompt Information ==============================================='
65-
echo 'There found several moderate severity vulnerabilities in this repo, please check in the package or lock file to repo with: '
66-
echo 'npx lerna-audit'
67-
exit 1
68-
fi
69-
7046
check-format:
7147
if: ${{ github.event_name == 'pull_request' }}
7248
runs-on: ubuntu-latest

packages/adaptivecards-tools-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"adaptive-expressions": "^4.20.0",
4848
"adaptivecards": "~2.10.0",
4949
"adaptivecards-templating": "^2.1.0",
50-
"markdown-it": "^12.2.0",
50+
"markdown-it": "^12.3.2",
5151
"react": "^17.0.2"
5252
},
5353
"publishConfig": {

packages/adaptivecards-tools-sdk/pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/src/commands/models/accountLoginAzure.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,17 @@ export const accountLoginAzureCommand: CLICommand = {
4444
],
4545
examples: [
4646
{
47-
command: `${process.env.TEAMSFX_CLI_BIN_NAME} auth login azure --service-principal -u USERNAME -p SECRET --tenant TENANT_ID`,
47+
command: `${process.env.TEAMSFX_CLI_BIN_NAME} auth login azure --interactive false --service-principal -u USERNAME -p SECRET --tenant TENANT_ID`,
4848
description: "Log in with a service principal using client secret",
4949
},
5050
{
51-
command: `${process.env.TEAMSFX_CLI_BIN_NAME} auth login azure --service-principal -u USERNAME -p "C:/Users/mycertfile.pem" --tenant TENANT_ID`,
51+
command: `${process.env.TEAMSFX_CLI_BIN_NAME} auth login azure --interactive false --service-principal -u USERNAME -p "C:/Users/mycertfile.pem" --tenant TENANT_ID`,
5252
description: "Log in with a service principal using client certificate",
5353
},
5454
],
5555
telemetry: {
5656
event: TelemetryEvent.AccountLoginAzure,
5757
},
58-
defaultInteractiveOption: false,
5958
handler: async (ctx) => {
6059
const args = ctx.optionValues;
6160
const isSP = args["service-principal"] as boolean;

packages/cli/src/commonlib/azureLogin.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import {
1717
SubscriptionInfo,
1818
UserError,
1919
} from "@microsoft/teamsfx-api";
20-
import { AzureScopes, isValidProjectV3 } from "@microsoft/teamsfx-core";
20+
import {
21+
AzureScopes,
22+
isValidProjectV3,
23+
InvalidAzureSubscriptionError,
24+
} from "@microsoft/teamsfx-core";
2125
import * as fs from "fs-extra";
2226
import * as path from "path";
2327
import CLIUIInstance from "../userInteraction";
@@ -41,6 +45,7 @@ import {
4145
import { LoginStatus, login } from "./common/login";
4246
import CLILogProvider from "./log";
4347
import { MemoryCache } from "./memoryCache";
48+
import ui from "../userInteraction";
4449

4550
const accountName = "azure";
4651
const scopes = ["https://management.core.windows.net/user_impersonation"];
@@ -538,26 +543,23 @@ async function listAll<T>(
538543
return all;
539544
}
540545

541-
import { InvalidAzureSubscriptionError } from "@microsoft/teamsfx-core";
542546
import AzureLoginCI from "./azureLoginCI";
543547
import AzureAccountProviderUserPassword from "./azureLoginUserPassword";
544548

545-
const ciEnabled = process.env.CI_ENABLED;
546549
// todo delete ciEnabled
547-
const azureLogin =
548-
ciEnabled && ciEnabled === "true"
549-
? AzureSpCrypto.checkAzureSPFile()
550-
? AzureLoginCI
551-
: AzureAccountProviderUserPassword
552-
: AzureSpCrypto.checkAzureSPFile()
550+
const azureLogin = !ui.interactive
551+
? AzureSpCrypto.checkAzureSPFile()
553552
? AzureLoginCI
554-
: AzureAccountManager.getInstance();
553+
: AzureAccountProviderUserPassword
554+
: AzureSpCrypto.checkAzureSPFile()
555+
? AzureLoginCI
556+
: AzureAccountManager.getInstance();
555557

556558
export default azureLogin;
557559

558560
// todo merge with default export, this function fix bug when user already logins with service principal, and he logins interactively, default azureLogin will return azureLoginCIProvider
559561
export function getAzureProvider() {
560-
return ciEnabled && ciEnabled === "true"
562+
return !ui.interactive
561563
? AzureSpCrypto.checkAzureSPFile()
562564
? AzureLoginCI
563565
: AzureAccountProviderUserPassword

packages/cli/src/commonlib/codeFlowLogin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export class CodeFlowLogin {
270270
})
271271
.catch(async (error) => {
272272
CliCodeLogInstance.necessaryLog(
273-
LogLevel.Error,
273+
LogLevel.Debug,
274274
"[Login] Failed to retrieve token silently. If you encounter this problem multiple times, you can delete `" +
275275
path.join(os.homedir(), ".fx", "account") +
276276
"` and try again. " +
@@ -322,7 +322,7 @@ export class CodeFlowLogin {
322322
}
323323
} catch (error: any) {
324324
CliCodeLogInstance.necessaryLog(
325-
LogLevel.Error,
325+
LogLevel.Debug,
326326
"[Login] Failed to retrieve token silently. If you encounter this problem multiple times, you can delete `" +
327327
path.join(os.homedir(), ".fx", "account") +
328328
"` and try again. " +
@@ -366,7 +366,7 @@ export class CodeFlowLogin {
366366
throw error;
367367
} else {
368368
CliCodeLogInstance.necessaryLog(
369-
LogLevel.Error,
369+
LogLevel.Debug,
370370
"[Login] Failed to retrieve tenant token silently. If you encounter this problem multiple times, you can delete `" +
371371
path.join(os.homedir(), ".fx", "account") +
372372
"` and try again. " +
@@ -415,7 +415,7 @@ export class CodeFlowLogin {
415415
throw error;
416416
} else {
417417
CliCodeLogInstance.necessaryLog(
418-
LogLevel.Error,
418+
LogLevel.Debug,
419419
"[Login] Failed to retrieve tenant token silently. If you encounter this problem multiple times, you can delete `" +
420420
path.join(os.homedir(), ".fx", "account") +
421421
"` and try again. " +

packages/cli/src/commonlib/m365Login.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { m365CacheName, signedIn, signedOut } from "./common/constant";
2020
import { LoginStatus } from "./common/login";
2121
import M365TokenProviderUserPassword from "./m365LoginUserPassword";
2222
import { AuthSvcScopes, setRegion } from "@microsoft/teamsfx-core";
23+
import ui from "../userInteraction";
2324

2425
const SERVER_PORT = 0;
2526

@@ -77,7 +78,7 @@ export class M365Login extends BasicLogin implements M365TokenProvider {
7778
if (M365Login.codeFlowInstance.account) {
7879
const regionTokenRes = await M365Login.codeFlowInstance.getTokenByScopes(AuthSvcScopes);
7980
if (regionTokenRes.isOk()) {
80-
setRegion(regionTokenRes.value);
81+
await setRegion(regionTokenRes.value);
8182
}
8283
} else {
8384
needLogin = true;
@@ -87,7 +88,7 @@ export class M365Login extends BasicLogin implements M365TokenProvider {
8788
if (needLogin == true && M365Login.codeFlowInstance.account) {
8889
const regionTokenRes = await M365Login.codeFlowInstance.getTokenByScopes(AuthSvcScopes);
8990
if (regionTokenRes.isOk()) {
90-
setRegion(regionTokenRes.value);
91+
await setRegion(regionTokenRes.value);
9192
}
9293
}
9394

@@ -145,8 +146,6 @@ export class M365Login extends BasicLogin implements M365TokenProvider {
145146
}
146147
}
147148

148-
const ciEnabled = process.env.CI_ENABLED;
149-
const m365Login =
150-
ciEnabled && ciEnabled === "true" ? M365TokenProviderUserPassword : M365Login.getInstance();
149+
const m365Login = !ui.interactive ? M365TokenProviderUserPassword : M365Login.getInstance();
151150

152151
export default m365Login;

packages/cli/src/userInteraction.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,9 @@ import { getColorizedString } from "./utils";
5050
type ValidationType<T> = (input: T) => string | boolean | Promise<string | boolean>;
5151

5252
class CLIUserInteraction implements UserInteraction {
53-
get ciEnabled(): boolean {
54-
return process.env.CI_ENABLED === "true";
55-
}
5653
private _interactive = true;
5754
get interactive(): boolean {
58-
if (this.ciEnabled) {
55+
if (process.env.CI_ENABLED === "true") {
5956
return false;
6057
} else {
6158
return this._interactive;
@@ -534,7 +531,7 @@ class CLIUserInteraction implements UserInteraction {
534531
}
535532

536533
public async openUrl(link: string): Promise<Result<boolean, FxError>> {
537-
if (!this.ciEnabled) await open(link);
534+
if (!this.interactive) await open(link);
538535
return ok(true);
539536
}
540537

packages/cli/tests/unit/ui.tests.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { logger } from "../../src/commonlib/logger";
2020
import * as customizedPrompts from "../../src/prompts";
2121
import UI from "../../src/userInteraction";
2222
import { expect } from "./utils";
23+
import mockedEnv from "mocked-env";
2324

2425
describe("User Interaction Tests", function () {
2526
const sandbox = sinon.createSandbox();
@@ -413,17 +414,21 @@ describe("User Interaction Tests", function () {
413414
afterEach(() => {
414415
sandbox.restore();
415416
});
416-
it("Check process.env", () => {
417-
expect(UI.ciEnabled).equals(process.env.CI_EANBLED === "true");
418-
});
419417
it("interactive = true", async () => {
420-
sandbox.stub(UI, "ciEnabled").value(false);
418+
const mockedEnvRestore = mockedEnv({
419+
CI_ENABLED: "true",
420+
});
421421
UI.interactive = true;
422-
expect(UI.interactive).equals(true);
422+
expect(UI.interactive).equals(false);
423+
mockedEnvRestore();
423424
});
424425
it("interactive = false when ciEnabled", async () => {
425-
sandbox.stub(UI, "ciEnabled").value(true);
426+
const mockedEnvRestore = mockedEnv({
427+
CI_ENABLED: "false",
428+
});
429+
UI.interactive = false;
426430
expect(UI.interactive).equals(false);
431+
mockedEnvRestore();
427432
});
428433

429434
it("Create Progress Bar", async () => {

0 commit comments

Comments
 (0)