From 0b1568d3d18f6b7be49c0b3a6857d2edb5901868 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 1 Oct 2024 05:04:35 +0000 Subject: [PATCH 01/73] Log notice, set output var --- eng/scripts/TypeSpec-Requirement.ps1 | 8 ++++++++ .../test/typespec-requirement.test.ts | 2 ++ 2 files changed, 10 insertions(+) diff --git a/eng/scripts/TypeSpec-Requirement.ps1 b/eng/scripts/TypeSpec-Requirement.ps1 index d1ea69b4914a..dfb9d1084ae7 100644 --- a/eng/scripts/TypeSpec-Requirement.ps1 +++ b/eng/scripts/TypeSpec-Requirement.ps1 @@ -168,6 +168,14 @@ else { if ($responseStatus -eq 200) { LogInfo " Branch 'main' contains path '$servicePath/stable', so spec already exists and is not required to use TypeSpec" + + $notice = "Brownfield services will soon be required to convert from OpenAPI to TypeSpec. See https://aka.ms/azsdk/typespec." + LogNoticeForFile $file $notice + + if ($env:GITHUB_OUTPUT) { + # Set output to be used later in /.github/workflows/TypeSpec-Requirement.yaml + Add-Content -Path $env:GITHUB_OUTPUT -Value "spec-lifecycle=brownfield" + } } elseif ($responseStatus -eq 404) { LogInfo " Branch 'main' does not contain path '$servicePath/stable', so spec is new and must use TypeSpec" diff --git a/eng/tools/typespec-requirement/test/typespec-requirement.test.ts b/eng/tools/typespec-requirement/test/typespec-requirement.test.ts index fa01dffde1e1..e4872dcef5c9 100644 --- a/eng/tools/typespec-requirement/test/typespec-requirement.test.ts +++ b/eng/tools/typespec-requirement/test/typespec-requirement.test.ts @@ -57,6 +57,8 @@ test.concurrent("Hand-written, exists in main", async ({ expect }) => { expect(stdout).toContain("was not generated from TypeSpec"); expect(stdout).toContain("'main' contains path"); + expect(stdout.toLowerCase()).toContain("notice"); + expect(stdout).toContain("will soon be required to convert"); expect(exitCode).toBe(0); }); From f870b430ef2f7abfedf5373644be022384e8a127 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 1 Oct 2024 05:04:55 +0000 Subject: [PATCH 02/73] Upload artifact named "key--value" --- .github/workflows/typespec-requirement.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index 3f3b4c9831b6..dd68769e7af9 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -21,9 +21,23 @@ jobs: - name: Setup Node and run `npm ci` uses: ./.github/actions/setup-node-npm-ci + # Sets output "spec-lifecycle" - run: | eng/scripts/TypeSpec-Requirement.ps1 ` -BaseCommitish HEAD^ ` -TargetCommitish HEAD ` -SpecType ${{ matrix.spec-type }} + id: tsr-ps1 shell: pwsh + + - name: Create empty file to upload artifact + run: touch empty.txt + + # Upload artifact named "key--value", so consumers only need artifact names + # Example: spec-lifecycle-data-plane--brownfield + - uses: actions/upload-artifact@v4 + with: + name: spec-lifecycle-${{ matrix.spec-type }}--${{ steps.tsr-ps1.outputs.spec-lifecycle }} + path: empty.txt + if-no-files-found: error + overwrite: true From 97e076e789b678d2b021780b3da685051f682ea2 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 1 Oct 2024 05:14:21 +0000 Subject: [PATCH 03/73] Only upload artifact if output set --- .github/workflows/typespec-requirement.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index dd68769e7af9..6d4451da16cb 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -30,12 +30,14 @@ jobs: id: tsr-ps1 shell: pwsh - - name: Create empty file to upload artifact + - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} + name: Create empty file to upload artifact run: touch empty.txt # Upload artifact named "key--value", so consumers only need artifact names # Example: spec-lifecycle-data-plane--brownfield - - uses: actions/upload-artifact@v4 + - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} + uses: actions/upload-artifact@v4 with: name: spec-lifecycle-${{ matrix.spec-type }}--${{ steps.tsr-ps1.outputs.spec-lifecycle }} path: empty.txt From d928d0277911942e74d21141d16c23d2c7e96024 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 1 Oct 2024 05:15:23 +0000 Subject: [PATCH 04/73] Improve comment --- .github/workflows/typespec-requirement.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index 6d4451da16cb..d0b031aef6c9 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -21,7 +21,7 @@ jobs: - name: Setup Node and run `npm ci` uses: ./.github/actions/setup-node-npm-ci - # Sets output "spec-lifecycle" + # May set output "spec-lifecycle" - run: | eng/scripts/TypeSpec-Requirement.ps1 ` -BaseCommitish HEAD^ ` From 6df9cd35479ba254f2a23a41b95fbac02b9b5e9c Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 1 Oct 2024 18:15:58 +0000 Subject: [PATCH 05/73] Add completed workflow --- .github/workflows/scripts/package-lock.json | 468 ++++++++++++++++++ .github/workflows/scripts/package.json | 7 + .../scripts/typespec-requirement-completed.js | 73 +++ .github/workflows/scripts/util.js | 151 ++++++ .../typespec-requirement-completed.yaml | 38 ++ .gitignore | 2 + 6 files changed, 739 insertions(+) create mode 100644 .github/workflows/scripts/package-lock.json create mode 100644 .github/workflows/scripts/package.json create mode 100644 .github/workflows/scripts/typespec-requirement-completed.js create mode 100644 .github/workflows/scripts/util.js create mode 100644 .github/workflows/typespec-requirement-completed.yaml diff --git a/.github/workflows/scripts/package-lock.json b/.github/workflows/scripts/package-lock.json new file mode 100644 index 000000000000..db884d99a14b --- /dev/null +++ b/.github/workflows/scripts/package-lock.json @@ -0,0 +1,468 @@ +{ + "name": "scripts", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@octokit/webhooks-types": "^7.5.1", + "@types/github-script": "github:actions/github-script", + "@types/node": "^20.0.0" + } + }, + "node_modules/@actions/core": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", + "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" + } + }, + "node_modules/@actions/exec": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", + "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/io": "^1.0.1" + } + }, + "node_modules/@actions/github": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", + "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/http-client": "^2.2.0", + "@octokit/core": "^5.0.1", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + } + }, + "node_modules/@actions/glob": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.4.0.tgz", + "integrity": "sha512-+eKIGFhsFa4EBwaf/GMyzCdWrXWymGXfFmZU3FHQvYS8mPcHtTtZONbkcqqUMzw9mJ/pImEBFET1JNifhqGsAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/core": "^1.9.1", + "minimatch": "^3.0.4" + } + }, + "node_modules/@actions/http-client": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", + "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "node_modules/@actions/io": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", + "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", + "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.1.0", + "@octokit/request": "^8.3.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", + "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", + "integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request": "^8.3.0", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", + "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", + "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-request-log": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", + "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", + "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-retry": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.1.tgz", + "integrity": "sha512-SKs+Tz9oj0g4p28qkZwl/topGcb0k0qPNX/i7vBKmDsjoeqnVfFUquqrE/O9oJY7+oLzdCtkiWSXLpLjvl6uog==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^12.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=5" + } + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/request": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", + "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^9.0.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", + "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/types": { + "version": "13.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.0.tgz", + "integrity": "sha512-CrooV/vKCXqwLa+osmHLIMUb87brpgUqlqkPGc6iE2wCkUvTrHiXFMhAKoDDaAAYJrtKtrFTgSQTg5nObBEaew==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^22.2.0" + } + }, + "node_modules/@octokit/webhooks-types": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.5.1.tgz", + "integrity": "sha512-1dozxWEP8lKGbtEu7HkRbK1F/nIPuJXNfT0gd96y6d3LcHZTtRtlf8xz3nicSJfesADxJyDh+mWBOsdLkqgzYw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/github-script": { + "name": "github-script", + "version": "7.0.1", + "resolved": "git+ssh://git@github.com/actions/github-script.git#660ec11d825b714d112a6bb9727086bc2cc500b2", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/core": "^1.10.1", + "@actions/exec": "^1.1.1", + "@actions/github": "^6.0.0", + "@actions/glob": "^0.4.0", + "@actions/io": "^1.1.3", + "@octokit/core": "^5.0.1", + "@octokit/plugin-request-log": "^4.0.0", + "@octokit/plugin-retry": "^6.0.1", + "@types/node": "^20.9.0" + }, + "engines": { + "node": ">=20.0.0 <21.0.0" + } + }, + "node_modules/@types/node": { + "version": "20.16.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.10.tgz", + "integrity": "sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" + }, + "node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + } + } +} diff --git a/.github/workflows/scripts/package.json b/.github/workflows/scripts/package.json new file mode 100644 index 000000000000..7e450a67224e --- /dev/null +++ b/.github/workflows/scripts/package.json @@ -0,0 +1,7 @@ +{ + "devDependencies": { + "@types/node": "^20.0.0", + "@types/github-script": "github:actions/github-script", + "@octokit/webhooks-types":"^7.5.1" + } +} diff --git a/.github/workflows/scripts/typespec-requirement-completed.js b/.github/workflows/scripts/typespec-requirement-completed.js new file mode 100644 index 000000000000..a39ff0c7eb16 --- /dev/null +++ b/.github/workflows/scripts/typespec-requirement-completed.js @@ -0,0 +1,73 @@ +// @ts-check + +// const { existsSync } = require("fs"); +// const { addLabelIfNotExists, removeLabelIfExists } = require("./util"); + +/** + * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments + */ +module.exports = async ({ github, context, core }) => { + console.log("context: " + JSON.stringify(context)); + + if (context.eventName !== "workflow_run" || context.action == "completed" ) { + throw new Error(`Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`); + } + + const payload = /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ (context.payload); + + const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: payload.repository.owner.login, + repo: payload.repository.name, + run_id: payload.workflow_run.id, + }); + + console.log("artifacts: " + JSON.stringify(artifacts)); + + // const specLifecycleDataPlaneBrownfield = existsSync("spec-lifecycle-data-plane-brownfield"); + // const specLifecycleResourceManagerBrownfield = existsSync("spec-lifecycle-resource-manager-brownfield"); + + // console.log(`specLifecycleDataPlaneBrownfield: ${specLifecycleDataPlaneBrownfield}`); + // console.log(`specLifecycleResourceManagerBrownfield: ${specLifecycleResourceManagerBrownfield}`); + + // const label = "brownfield"; + // if (specLifecycleDataPlaneBrownfield || specLifecycleResourceManagerBrownfield) { + // await addLabelIfNotExists(github, context, core, label); + // } + // else { + // await removeLabelIfExists(github, context, core, label); + // } + + // const payload = /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ (context.payload); + + // const owner = payload.workflow_run.head_repository.owner.login; + // const repo = payload.workflow_run.head_repository.name; + // const sha = payload.workflow_run.head_sha; + + // console.log(`Finding pull requests for '/${owner}/${repo}/${sha}'`); + + // // Must call this API, since 'payload.workflow_run.pull_requests' is empty for fork PRs + // const { data: pullRequests } = + // await github.rest.repos.listPullRequestsAssociatedWithCommit({ + // owner: owner, + // repo: repo, + // commit_sha: sha, + // }); + + // console.log(`Found ${pullRequests.length}`); + // if (pullRequests.length === 0) { + // console.log("No pull request associated with this commit."); + // } else if (pullRequests.length === 1) { + // const prNumber = pullRequests[0].number; + // await github.rest.issues.addLabels({ + // owner: context.repo.owner, + // repo: context.repo.repo, + // issue_number: prNumber, + // labels: ["pull-request-completed"], + // }); + // } else { + // console.log("Too many pull requests associated with this commit."); + // } + // } else { + // console.log("Not adding label 'pull-request-completed'"); + // } +}; \ No newline at end of file diff --git a/.github/workflows/scripts/util.js b/.github/workflows/scripts/util.js new file mode 100644 index 000000000000..3cf2874e77e9 --- /dev/null +++ b/.github/workflows/scripts/util.js @@ -0,0 +1,151 @@ +// // @ts-check + +// module.exports = { +// addLabelIfNotExists, +// getLabels, +// group, +// hasLabel, +// removeLabelIfExists, +// }; + +// /** @type {Map>} */ +// const labelCache = new Map(); + +// /** +// * @param {import('github-script').AsyncFunctionArguments['github']} github +// * @param {import('github-script').AsyncFunctionArguments['context']} context +// * @param {import('github-script').AsyncFunctionArguments['core']} core +// * @param {string} name +// * @returns {Promise} +// */ +// async function addLabelIfNotExists(github, context, core, name) { +// await group(`addLabelIfNotExists("${name}")`, async () => { +// // TODO: Add support for workflow_run from a pull_request context +// if (!context.payload.pull_request) { +// throw new Error("May only run in context of a pull request"); +// } + +// if (await hasLabel(github, context, name)) { +// console.log(`Already has label '${name}'`); +// return; +// } + +// core.notice(`Adding label '${name}'`); + +// const prNumber = context.payload.pull_request.number; +// const { data: labels } = await github.rest.issues.addLabels({ +// owner: context.repo.owner, +// repo: context.repo.repo, +// issue_number: prNumber, +// labels: [name], +// }); + +// const labelNames = new Set(labels.map((l) => l.name)); +// labelCache.set(prNumber, labelNames); +// }); +// } + +// /** +// * @param {import('github-script').AsyncFunctionArguments['github']} github +// * @param {import('github-script').AsyncFunctionArguments['context']} context +// * @returns {Promise>} Set of labels associated with the current PR +// */ +// async function getLabels(github, context) { +// return await group(`getLabels()`, async () => { +// if (!context.payload.pull_request) { +// throw new Error("May only run in context of a pull request"); +// } + +// const prNumber = context.payload.pull_request.number; + +// let labelNames = labelCache.get(prNumber); +// if (!labelNames) { +// const { data: labels } = await github.rest.issues.listLabelsOnIssue({ +// owner: context.repo.owner, +// repo: context.repo.repo, +// issue_number: prNumber, +// }); +// labelNames = new Set(labels.map((l) => l.name)); +// labelCache.set(prNumber, labelNames); +// } + +// console.log(`Labels: ${Array.from(labelNames).sort()}`); + +// return labelNames; +// }); +// } + +// /** +// * Wrap an async function in a log group +// * +// * @template T +// * @param {string} name +// * @param {() => Promise} fn +// */ +// async function group(name, fn) { +// // Uses console.group() instead of @actions/core.group() which doesn't support nesting +// console.group(name); +// try { +// return await fn(); +// } finally { +// console.groupEnd(); +// } +// } + +// /** +// * @param {import('github-script').AsyncFunctionArguments['github']} github +// * @param {import('github-script').AsyncFunctionArguments['context']} context +// * @param {string} name +// * @returns {Promise} True if the current PR contains the named label +// */ +// async function hasLabel(github, context, name) { +// return await group(`hasLabel("${name}")`, async () => { +// const result = (await getLabels(github, context)).has(name); +// console.log(`returning: ${result}`); +// return result; +// }); +// } + +// /** +// * @param {import('github-script').AsyncFunctionArguments['github']} github +// * @param {import('github-script').AsyncFunctionArguments['context']} context +// * @param {import('github-script').AsyncFunctionArguments['core']} core +// * @param {string} name +// * @returns {Promise} +// */ +// async function removeLabelIfExists(github, context, core, name) { +// await group(`removeLabelIfExists("${name}")`, async () => { +// if (!context.payload.pull_request) { +// throw new Error("May only run in context of a pull request"); +// } + +// if (!(await hasLabel(github, context, name))) { +// console.log(`Does not have label '${name}'`); +// return; +// } + +// core.notice(`Removing label '${name}'`); + +// const prNumber = context.payload.pull_request.number; +// try { +// const {data: labels} = await github.rest.issues.removeLabel({ +// owner: context.repo.owner, +// repo: context.repo.repo, +// issue_number: prNumber, +// name: name, +// }); + +// const labelNames = new Set(labels.map((l) => l.name)); +// labelCache.set(prNumber, labelNames); +// } catch (error) { +// /** @type {import("@octokit/request-error").RequestError} */ +// const requestError = error; + +// if (requestError.status == 404) { +// // Label does not exist +// } else { +// throw error; +// } +// } +// }); +// } diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml new file mode 100644 index 000000000000..a7b5750e045e --- /dev/null +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -0,0 +1,38 @@ +name: TypeSpec Requirement - Completed + +on: + workflow_run: + workflows: ["TypeSpec Requirement"] + types: [completed] + +jobs: + typespec-requirement-completed: + name: TypeSpec Requirement - Completed + + permissions: + contents: read + pull-requests: write + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + path: repo + + # TODO: List artifacts from JS instead of downloading from YAML + # - uses: actions/download-artifact@v4 + # with: + # # Must use "pattern" instead of "name" to avoid errors if artifact doesn't exist + # pattern: spec-lifecycle-* + # # Must specify token and repository, to pull from the base fork in fork PRs + # github-token: ${{ github.token }} + # repository: ${{ github.repository }} + # run-id: ${{ github.event.workflow_run.id }} + + - name: Add label if artifact + uses: actions/github-script@v7 + with: + script: | + const typespecRequirementCompleted = require('./repo/.github/workflows/scripts/pull-request-completed.js') + await typespecRequirementCompleted({ github, context, core }); \ No newline at end of file diff --git a/.gitignore b/.gitignore index 937f93a4aa54..b7400e94e3c1 100644 --- a/.gitignore +++ b/.gitignore @@ -118,6 +118,7 @@ warnings.txt # Blanket ignores *.js +!.github/workflows/scripts/*.js *.d.ts *.js.map *.d.ts.map @@ -134,6 +135,7 @@ eng/tools/**/dist # No package-lock.json files should be commited except the top-level. **/package-lock.json !/package-lock.json +!/.github/workflows/scripts/package-lock.json # No Armstrong outputs should be commited except the tf files. **/terraform/**/*.json From 98612e264e0c1dee3abd47310c3c4569691011bb Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 1 Oct 2024 18:29:12 +0000 Subject: [PATCH 06/73] Fix artifact name --- .github/workflows/typespec-requirement.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index d0b031aef6c9..a81765701301 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -39,7 +39,7 @@ jobs: - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} uses: actions/upload-artifact@v4 with: - name: spec-lifecycle-${{ matrix.spec-type }}--${{ steps.tsr-ps1.outputs.spec-lifecycle }} + name: spec-lifecycle-${{ matrix.spec-type }}-${{ steps.tsr-ps1.outputs.spec-lifecycle }} path: empty.txt if-no-files-found: error overwrite: true From 56260214ea7c3fc0a90213f8ea4f90fac9fc3189 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 1 Oct 2024 18:33:09 +0000 Subject: [PATCH 07/73] Typo --- .github/workflows/typespec-requirement-completed.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index a7b5750e045e..4bc7691f3706 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -34,5 +34,5 @@ jobs: uses: actions/github-script@v7 with: script: | - const typespecRequirementCompleted = require('./repo/.github/workflows/scripts/pull-request-completed.js') + const typespecRequirementCompleted = require('./repo/.github/workflows/scripts/typespec-requirement-completed.js') await typespecRequirementCompleted({ github, context, core }); \ No newline at end of file From 6ccbd2c2117c6a50b4a792e1a081caa67a6d80a1 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 1 Oct 2024 23:12:47 +0000 Subject: [PATCH 08/73] pretty-print --- .github/workflows/scripts/typespec-requirement-completed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scripts/typespec-requirement-completed.js b/.github/workflows/scripts/typespec-requirement-completed.js index a39ff0c7eb16..2f15714ea7b8 100644 --- a/.github/workflows/scripts/typespec-requirement-completed.js +++ b/.github/workflows/scripts/typespec-requirement-completed.js @@ -7,7 +7,7 @@ * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ module.exports = async ({ github, context, core }) => { - console.log("context: " + JSON.stringify(context)); + console.log("context: " + JSON.stringify(context, null, 2)); if (context.eventName !== "workflow_run" || context.action == "completed" ) { throw new Error(`Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`); @@ -21,7 +21,7 @@ module.exports = async ({ github, context, core }) => { run_id: payload.workflow_run.id, }); - console.log("artifacts: " + JSON.stringify(artifacts)); + console.log("artifacts: " + JSON.stringify(artifacts, null, 2)); // const specLifecycleDataPlaneBrownfield = existsSync("spec-lifecycle-data-plane-brownfield"); // const specLifecycleResourceManagerBrownfield = existsSync("spec-lifecycle-resource-manager-brownfield"); From b8458c72c5cae36bc962b2199fa2352a72528bf4 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 1 Oct 2024 23:16:17 +0000 Subject: [PATCH 09/73] Sparse checkout --- .github/workflows/typespec-requirement-completed.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index 4bc7691f3706..b99806c852ea 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -19,6 +19,8 @@ jobs: - uses: actions/checkout@v4 with: path: repo + sparse-checkout: | + .github/workflows # TODO: List artifacts from JS instead of downloading from YAML # - uses: actions/download-artifact@v4 From 267f3faa5bb96027b080cc8ef295d5349b15ea2a Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 2 Oct 2024 06:44:41 +0000 Subject: [PATCH 10/73] Remove unnecessary aritfact download --- .../workflows/typespec-requirement-completed.yaml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index b99806c852ea..8d197a463b69 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -18,23 +18,12 @@ jobs: steps: - uses: actions/checkout@v4 with: - path: repo sparse-checkout: | .github/workflows - # TODO: List artifacts from JS instead of downloading from YAML - # - uses: actions/download-artifact@v4 - # with: - # # Must use "pattern" instead of "name" to avoid errors if artifact doesn't exist - # pattern: spec-lifecycle-* - # # Must specify token and repository, to pull from the base fork in fork PRs - # github-token: ${{ github.token }} - # repository: ${{ github.repository }} - # run-id: ${{ github.event.workflow_run.id }} - - name: Add label if artifact uses: actions/github-script@v7 with: script: | - const typespecRequirementCompleted = require('./repo/.github/workflows/scripts/typespec-requirement-completed.js') + const typespecRequirementCompleted = require('./.github/workflows/scripts/typespec-requirement-completed.js') await typespecRequirementCompleted({ github, context, core }); \ No newline at end of file From c6ea8f0ec4620f681f7408e9c64b8d81e2587c53 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 2 Oct 2024 18:20:55 +0000 Subject: [PATCH 11/73] WIP: Fix scripts --- .../scripts/typespec-requirement-completed.js | 77 ++++++---- .github/workflows/scripts/util.js | 136 ++++++------------ 2 files changed, 89 insertions(+), 124 deletions(-) diff --git a/.github/workflows/scripts/typespec-requirement-completed.js b/.github/workflows/scripts/typespec-requirement-completed.js index 2f15714ea7b8..2f84fac47d9c 100644 --- a/.github/workflows/scripts/typespec-requirement-completed.js +++ b/.github/workflows/scripts/typespec-requirement-completed.js @@ -1,43 +1,52 @@ // @ts-check -// const { existsSync } = require("fs"); -// const { addLabelIfNotExists, removeLabelIfExists } = require("./util"); +const { addLabelIfNotExists, removeLabelIfExists } = require("./util"); /** - * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments + * @param {import('github-script').AsyncFunctionArguments["github"]} github + * @param {import('github-script').AsyncFunctionArguments["context"]} context + * @param {import('github-script').AsyncFunctionArguments["core"]} core */ -module.exports = async ({ github, context, core }) => { +module.exports = async (github, context, core) => { console.log("context: " + JSON.stringify(context, null, 2)); - if (context.eventName !== "workflow_run" || context.action == "completed" ) { - throw new Error(`Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`); + if (context.eventName !== "workflow_run" || context.action == "completed") { + throw new Error( + `Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`, + ); } - const payload = /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ (context.payload); + const payload = + /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( + context.payload + ); const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: payload.repository.owner.login, - repo: payload.repository.name, + owner: payload.workflow_run.repository.owner.login, + repo: payload.workflow_run.repository.name, run_id: payload.workflow_run.id, }); console.log("artifacts: " + JSON.stringify(artifacts, null, 2)); - // const specLifecycleDataPlaneBrownfield = existsSync("spec-lifecycle-data-plane-brownfield"); - // const specLifecycleResourceManagerBrownfield = existsSync("spec-lifecycle-resource-manager-brownfield"); + const artifactNames = artifacts.data.artifacts.map((a) => a.name); - // console.log(`specLifecycleDataPlaneBrownfield: ${specLifecycleDataPlaneBrownfield}`); - // console.log(`specLifecycleResourceManagerBrownfield: ${specLifecycleResourceManagerBrownfield}`); - - // const label = "brownfield"; - // if (specLifecycleDataPlaneBrownfield || specLifecycleResourceManagerBrownfield) { - // await addLabelIfNotExists(github, context, core, label); - // } - // else { - // await removeLabelIfExists(github, context, core, label); - // } - - // const payload = /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ (context.payload); + const label = "brownfield"; + if ( + artifactNames.includes("spec-lifecycle-data-plane-brownfield") || + artifactNames.includes("spec-lifecycle-resource-manager-brownfield") + ) { + await addLabelIfNotExists( + /** @type {import('github-script').AsyncFunctionArguments} */ ({ + github, + context, + core, + }), + label, + ); + } else { + await removeLabelIfExists(github, context, core, label); + } // const owner = payload.workflow_run.head_repository.owner.login; // const repo = payload.workflow_run.head_repository.name; @@ -45,13 +54,19 @@ module.exports = async ({ github, context, core }) => { // console.log(`Finding pull requests for '/${owner}/${repo}/${sha}'`); - // // Must call this API, since 'payload.workflow_run.pull_requests' is empty for fork PRs - // const { data: pullRequests } = - // await github.rest.repos.listPullRequestsAssociatedWithCommit({ - // owner: owner, - // repo: repo, - // commit_sha: sha, - // }); + // (property) listPullRequestsAssociatedWithCommit: { + // parameters: RequestParameters & Endpoints["GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"]["parameters"]; + // response: Endpoints["GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"]["response"]; + // } + + // Must call this API, since 'payload.workflow_run.pull_requests' is empty for fork PRs + // Must use 'head_repository' instead of 'repository', + // const { data: pullRequests } = + // await github.rest.repos.listPullRequestsAssociatedWithCommit({ + // owner: owner, + // repo: repo, + // commit_sha: sha, + // }); // console.log(`Found ${pullRequests.length}`); // if (pullRequests.length === 0) { @@ -70,4 +85,4 @@ module.exports = async ({ github, context, core }) => { // } else { // console.log("Not adding label 'pull-request-completed'"); // } -}; \ No newline at end of file +}; diff --git a/.github/workflows/scripts/util.js b/.github/workflows/scripts/util.js index 3cf2874e77e9..e4c5f97cd31f 100644 --- a/.github/workflows/scripts/util.js +++ b/.github/workflows/scripts/util.js @@ -1,24 +1,20 @@ -// // @ts-check - -// module.exports = { -// addLabelIfNotExists, -// getLabels, -// group, -// hasLabel, -// removeLabelIfExists, -// }; - -// /** @type {Map>} */ -// const labelCache = new Map(); - -// /** -// * @param {import('github-script').AsyncFunctionArguments['github']} github -// * @param {import('github-script').AsyncFunctionArguments['context']} context -// * @param {import('github-script').AsyncFunctionArguments['core']} core -// * @param {string} name -// * @returns {Promise} -// */ -// async function addLabelIfNotExists(github, context, core, name) { +// @ts-check + +module.exports = { + addLabelIfNotExists, + group, + removeLabelIfExists, +}; + +/** @type {Map>} */ +const labelCache = new Map(); + +/** + * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments + * @param {string} name + * @returns {Promise} + */ +async function addLabelIfNotExists({github, context, core}, name) { // await group(`addLabelIfNotExists("${name}")`, async () => { // // TODO: Add support for workflow_run from a pull_request context // if (!context.payload.pull_request) { @@ -43,77 +39,31 @@ // const labelNames = new Set(labels.map((l) => l.name)); // labelCache.set(prNumber, labelNames); // }); -// } - -// /** -// * @param {import('github-script').AsyncFunctionArguments['github']} github -// * @param {import('github-script').AsyncFunctionArguments['context']} context -// * @returns {Promise>} Set of labels associated with the current PR -// */ -// async function getLabels(github, context) { -// return await group(`getLabels()`, async () => { -// if (!context.payload.pull_request) { -// throw new Error("May only run in context of a pull request"); -// } - -// const prNumber = context.payload.pull_request.number; - -// let labelNames = labelCache.get(prNumber); -// if (!labelNames) { -// const { data: labels } = await github.rest.issues.listLabelsOnIssue({ -// owner: context.repo.owner, -// repo: context.repo.repo, -// issue_number: prNumber, -// }); -// labelNames = new Set(labels.map((l) => l.name)); -// labelCache.set(prNumber, labelNames); -// } - -// console.log(`Labels: ${Array.from(labelNames).sort()}`); - -// return labelNames; -// }); -// } - -// /** -// * Wrap an async function in a log group -// * -// * @template T -// * @param {string} name -// * @param {() => Promise} fn -// */ -// async function group(name, fn) { -// // Uses console.group() instead of @actions/core.group() which doesn't support nesting -// console.group(name); -// try { -// return await fn(); -// } finally { -// console.groupEnd(); -// } -// } - -// /** -// * @param {import('github-script').AsyncFunctionArguments['github']} github -// * @param {import('github-script').AsyncFunctionArguments['context']} context -// * @param {string} name -// * @returns {Promise} True if the current PR contains the named label -// */ -// async function hasLabel(github, context, name) { -// return await group(`hasLabel("${name}")`, async () => { -// const result = (await getLabels(github, context)).has(name); -// console.log(`returning: ${result}`); -// return result; -// }); -// } - -// /** -// * @param {import('github-script').AsyncFunctionArguments['github']} github -// * @param {import('github-script').AsyncFunctionArguments['context']} context -// * @param {import('github-script').AsyncFunctionArguments['core']} core -// * @param {string} name -// * @returns {Promise} -// */ -// async function removeLabelIfExists(github, context, core, name) { +} + +/** + * Wrap an async function in a log group + * + * @template T + * @param {string} name + * @param {() => Promise} fn + */ +async function group(name, fn) { + // Uses console.group() instead of @actions/core.group() which doesn't support nesting + console.group(name); + try { + return await fn(); + } finally { + console.groupEnd(); + } +} + +/** + * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments + * @param {string} name + * @returns {Promise} + */ +async function removeLabelIfExists({github, context, core}, name) { // await group(`removeLabelIfExists("${name}")`, async () => { // if (!context.payload.pull_request) { // throw new Error("May only run in context of a pull request"); @@ -148,4 +98,4 @@ // } // } // }); -// } +} From 8b9d81581fa588a1331b7a10293c11e351a43e9b Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 2 Oct 2024 18:21:21 +0000 Subject: [PATCH 12/73] Yaml parameter destructuring --- .github/workflows/typespec-requirement-completed.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index 8d197a463b69..c567d3a4e4c4 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -26,4 +26,4 @@ jobs: with: script: | const typespecRequirementCompleted = require('./.github/workflows/scripts/typespec-requirement-completed.js') - await typespecRequirementCompleted({ github, context, core }); \ No newline at end of file + await typespecRequirementCompleted(github, context, core); \ No newline at end of file From 3434be6c9746850acb0ea671ba2a84e3f5757532 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 2 Oct 2024 18:23:16 +0000 Subject: [PATCH 13/73] Fix script args --- .../scripts/typespec-requirement-completed.js | 8 +++----- .github/workflows/scripts/util.js | 16 ++++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/scripts/typespec-requirement-completed.js b/.github/workflows/scripts/typespec-requirement-completed.js index 2f84fac47d9c..67621c16ec59 100644 --- a/.github/workflows/scripts/typespec-requirement-completed.js +++ b/.github/workflows/scripts/typespec-requirement-completed.js @@ -37,11 +37,9 @@ module.exports = async (github, context, core) => { artifactNames.includes("spec-lifecycle-resource-manager-brownfield") ) { await addLabelIfNotExists( - /** @type {import('github-script').AsyncFunctionArguments} */ ({ - github, - context, - core, - }), + github, + context, + core, label, ); } else { diff --git a/.github/workflows/scripts/util.js b/.github/workflows/scripts/util.js index e4c5f97cd31f..d12f15e2cff4 100644 --- a/.github/workflows/scripts/util.js +++ b/.github/workflows/scripts/util.js @@ -6,15 +6,17 @@ module.exports = { removeLabelIfExists, }; -/** @type {Map>} */ -const labelCache = new Map(); +// /** @type {Map>} */ +// const labelCache = new Map(); /** - * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments + * @param {import('github-script').AsyncFunctionArguments["github"]} github + * @param {import('github-script').AsyncFunctionArguments["context"]} context + * @param {import('github-script').AsyncFunctionArguments["core"]} core * @param {string} name * @returns {Promise} */ -async function addLabelIfNotExists({github, context, core}, name) { +async function addLabelIfNotExists(github, context, core, name) { // await group(`addLabelIfNotExists("${name}")`, async () => { // // TODO: Add support for workflow_run from a pull_request context // if (!context.payload.pull_request) { @@ -59,11 +61,13 @@ async function group(name, fn) { } /** - * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments + * @param {import('github-script').AsyncFunctionArguments["github"]} github + * @param {import('github-script').AsyncFunctionArguments["context"]} context + * @param {import('github-script').AsyncFunctionArguments["core"]} core * @param {string} name * @returns {Promise} */ -async function removeLabelIfExists({github, context, core}, name) { +async function removeLabelIfExists(github, context, core, name) { // await group(`removeLabelIfExists("${name}")`, async () => { // if (!context.payload.pull_request) { // throw new Error("May only run in context of a pull request"); From b7aaf091d6d5052d567762297f5380a525e8eeee Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 25 Oct 2024 01:27:48 +0000 Subject: [PATCH 14/73] Use "=" in artifact name --- .../scripts/typespec-requirement-completed.js | 4 +- .github/workflows/typespec-requirement.yaml | 71 +++++++++++-------- 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/.github/workflows/scripts/typespec-requirement-completed.js b/.github/workflows/scripts/typespec-requirement-completed.js index 67621c16ec59..8a11168b5616 100644 --- a/.github/workflows/scripts/typespec-requirement-completed.js +++ b/.github/workflows/scripts/typespec-requirement-completed.js @@ -33,8 +33,8 @@ module.exports = async (github, context, core) => { const label = "brownfield"; if ( - artifactNames.includes("spec-lifecycle-data-plane-brownfield") || - artifactNames.includes("spec-lifecycle-resource-manager-brownfield") + artifactNames.includes("spec-lifecycle-data-plane=brownfield") || + artifactNames.includes("spec-lifecycle-resource-manager=brownfield") ) { await addLabelIfNotExists( github, diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index a81765701301..23d7627839c0 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -13,33 +13,44 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - # Required since "HEAD^" is passed to TypeSpec-Requirement.ps1 - fetch-depth: 2 - - - name: Setup Node and run `npm ci` - uses: ./.github/actions/setup-node-npm-ci - - # May set output "spec-lifecycle" - - run: | - eng/scripts/TypeSpec-Requirement.ps1 ` - -BaseCommitish HEAD^ ` - -TargetCommitish HEAD ` - -SpecType ${{ matrix.spec-type }} - id: tsr-ps1 - shell: pwsh - - - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} - name: Create empty file to upload artifact - run: touch empty.txt - - # Upload artifact named "key--value", so consumers only need artifact names - # Example: spec-lifecycle-data-plane--brownfield - - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} - uses: actions/upload-artifact@v4 - with: - name: spec-lifecycle-${{ matrix.spec-type }}-${{ steps.tsr-ps1.outputs.spec-lifecycle }} - path: empty.txt - if-no-files-found: error - overwrite: true + - uses: actions/checkout@v4 + with: + # Required since "HEAD^" is passed to TypeSpec-Requirement.ps1 + fetch-depth: 2 + + - name: Setup Node and run `npm ci` + uses: ./.github/actions/setup-node-npm-ci + + # Outputs + # - spec-lifecycle?: "brownfield" + - run: | + eng/scripts/TypeSpec-Requirement.ps1 ` + -BaseCommitish HEAD^ ` + -TargetCommitish HEAD ` + -SpecType ${{ matrix.spec-type }} + id: tsr-ps1 + shell: pwsh + + # TODO: Move to composite action + # https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-actions + + # When possible, it's best to upload an empty file with all information in the artifact name, so consumers + # can query the information without needing to download files to disk. + # + # A recommended format is "key1=value1,key2=value2,...". The maximum length is reported to be 260 characters. + # + # A full list of invalid artifact name characters is documented here: + # https://github.com/actions/toolkit/blob/main/packages/artifact/src/internal/upload/path-and-artifact-name-validation.ts + # + # Example: spec-lifecycle-data-plane=brownfield + - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} + name: Create empty file to upload artifact + run: touch empty.txt + + - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} + uses: actions/upload-artifact@v4 + with: + name: spec-lifecycle-${{ matrix.spec-type }}=${{ steps.tsr-ps1.outputs.spec-lifecycle }} + path: empty.txt + if-no-files-found: error + overwrite: true From e9121d6d312d7d18f87d8d86ccd2a0aa6c0b981d Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 25 Oct 2024 13:23:35 -0700 Subject: [PATCH 15/73] Add trailing newline --- .github/workflows/typespec-requirement-completed.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index c567d3a4e4c4..5676be23947d 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -26,4 +26,4 @@ jobs: with: script: | const typespecRequirementCompleted = require('./.github/workflows/scripts/typespec-requirement-completed.js') - await typespecRequirementCompleted(github, context, core); \ No newline at end of file + await typespecRequirementCompleted(github, context, core); From 6aea1efc482fd3d1330d16305b276f8d5ffb83dc Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 25 Oct 2024 21:19:41 +0000 Subject: [PATCH 16/73] Use composite actions --- .github/actions/setup-node-npm-ci/action.yml | 22 +++++++++++++ .../upload-keyvalue-artifact/action.yml | 31 +++++++++++++++++++ .github/workflows/typespec-requirement.yaml | 25 +++------------ 3 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 .github/actions/setup-node-npm-ci/action.yml create mode 100644 .github/actions/upload-keyvalue-artifact/action.yml diff --git a/.github/actions/setup-node-npm-ci/action.yml b/.github/actions/setup-node-npm-ci/action.yml new file mode 100644 index 000000000000..5d368fa9feda --- /dev/null +++ b/.github/actions/setup-node-npm-ci/action.yml @@ -0,0 +1,22 @@ +name: Setup Node 20 and run `npm ci` +description: Setup Node 20 and run `npm ci` + +inputs: + node-version: + description: 'Node version to use' + default: 20.x + +runs: + using: "composite" + + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + + - run: npm ci + shell: bash + + - run: npm ls -a + shell: bash + continue-on-error: true \ No newline at end of file diff --git a/.github/actions/upload-keyvalue-artifact/action.yml b/.github/actions/upload-keyvalue-artifact/action.yml new file mode 100644 index 000000000000..b737a8912af5 --- /dev/null +++ b/.github/actions/upload-keyvalue-artifact/action.yml @@ -0,0 +1,31 @@ +name: Upload KeyValue Artifact +description: Uploads an empty artifact with the specified key and value encoded in the name + +inputs: + key: + description: Key + required: true + value: + description: Value + required: true + +runs: + using: composite + + steps: + # When possible, it's best to upload an empty file with all information in the artifact name, so consumers + # can query the information without needing to download files to disk. + - name: Create empty file to upload artifact + run: "> $RUNNER_TEMP/empty.txt" + shell: bash + + # A recommended format is "key=value". The maximum length is reported to be 260 characters. + # + # A full list of invalid artifact name characters is documented here: + # https://github.com/actions/toolkit/blob/main/packages/artifact/src/internal/upload/path-and-artifact-name-validation.ts + - uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.key }}=${{ inputs.value }} + path: $RUNNER_TEMP/empty.txt + if-no-files-found: error + overwrite: true diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index 23d7627839c0..5aeef7fa5b94 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -31,26 +31,9 @@ jobs: id: tsr-ps1 shell: pwsh - # TODO: Move to composite action - # https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-actions - - # When possible, it's best to upload an empty file with all information in the artifact name, so consumers - # can query the information without needing to download files to disk. - # - # A recommended format is "key1=value1,key2=value2,...". The maximum length is reported to be 260 characters. - # - # A full list of invalid artifact name characters is documented here: - # https://github.com/actions/toolkit/blob/main/packages/artifact/src/internal/upload/path-and-artifact-name-validation.ts - # - # Example: spec-lifecycle-data-plane=brownfield - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} - name: Create empty file to upload artifact - run: touch empty.txt - - - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} - uses: actions/upload-artifact@v4 + uses: ./.github/actions/upload-keyvalue-artifact with: - name: spec-lifecycle-${{ matrix.spec-type }}=${{ steps.tsr-ps1.outputs.spec-lifecycle }} - path: empty.txt - if-no-files-found: error - overwrite: true + key: spec-lifecycle-${{ matrix.spec-type }} + value: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} + From 77a05cca40a14490abff30e0fe06c95ee130e3d1 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 25 Oct 2024 21:39:04 +0000 Subject: [PATCH 17/73] Fix upload --- .github/actions/upload-keyvalue-artifact/action.yml | 2 +- .github/workflows/typespec-requirement.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/upload-keyvalue-artifact/action.yml b/.github/actions/upload-keyvalue-artifact/action.yml index b737a8912af5..eaf0d04162cb 100644 --- a/.github/actions/upload-keyvalue-artifact/action.yml +++ b/.github/actions/upload-keyvalue-artifact/action.yml @@ -26,6 +26,6 @@ runs: - uses: actions/upload-artifact@v4 with: name: ${{ inputs.key }}=${{ inputs.value }} - path: $RUNNER_TEMP/empty.txt + path: ${{ runner.temp }}/empty.txt if-no-files-found: error overwrite: true diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index 5aeef7fa5b94..4aa37c4079bb 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -33,6 +33,7 @@ jobs: - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} uses: ./.github/actions/upload-keyvalue-artifact + name: Upload artifact with results with: key: spec-lifecycle-${{ matrix.spec-type }} value: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} From 10e5b532e6589d4045c0bbd0eea4192c8ecaf208 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 25 Oct 2024 22:40:12 +0000 Subject: [PATCH 18/73] WIP: get keyvalue artifacts --- .../get-keyvalue-artifacts/action.yaml | 13 + .github/actions/setup-node-npm-ci/action.yml | 22 - .../{action.yml => action.yaml} | 0 .github/{workflows => }/scripts/package.json | 0 .github/workflows/scripts/package-lock.json | 468 ------------------ .../scripts/typespec-requirement-completed.js | 86 ---- .github/workflows/scripts/util.js | 105 ---- .../typespec-requirement-completed.yaml | 17 +- 8 files changed, 23 insertions(+), 688 deletions(-) create mode 100644 .github/actions/get-keyvalue-artifacts/action.yaml delete mode 100644 .github/actions/setup-node-npm-ci/action.yml rename .github/actions/upload-keyvalue-artifact/{action.yml => action.yaml} (100%) rename .github/{workflows => }/scripts/package.json (100%) delete mode 100644 .github/workflows/scripts/package-lock.json delete mode 100644 .github/workflows/scripts/typespec-requirement-completed.js delete mode 100644 .github/workflows/scripts/util.js diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/get-keyvalue-artifacts/action.yaml new file mode 100644 index 000000000000..a39b1970ca07 --- /dev/null +++ b/.github/actions/get-keyvalue-artifacts/action.yaml @@ -0,0 +1,13 @@ +name: Get KeyValue Artifacts +description: Sets env vars corresponding to keys and values encoded in artifact names + +runs: + using: composite + + steps: + - name: Set env vars from artifact names + uses: actions/github-script@v7 + with: + script: | + const getKeyValueArtifacts = require('./.github/scripts/get-keyvalue-artifacts.js') + await getKeyValueArtifacts(github, context, core); diff --git a/.github/actions/setup-node-npm-ci/action.yml b/.github/actions/setup-node-npm-ci/action.yml deleted file mode 100644 index 5d368fa9feda..000000000000 --- a/.github/actions/setup-node-npm-ci/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Setup Node 20 and run `npm ci` -description: Setup Node 20 and run `npm ci` - -inputs: - node-version: - description: 'Node version to use' - default: 20.x - -runs: - using: "composite" - - steps: - - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node-version }} - - - run: npm ci - shell: bash - - - run: npm ls -a - shell: bash - continue-on-error: true \ No newline at end of file diff --git a/.github/actions/upload-keyvalue-artifact/action.yml b/.github/actions/upload-keyvalue-artifact/action.yaml similarity index 100% rename from .github/actions/upload-keyvalue-artifact/action.yml rename to .github/actions/upload-keyvalue-artifact/action.yaml diff --git a/.github/workflows/scripts/package.json b/.github/scripts/package.json similarity index 100% rename from .github/workflows/scripts/package.json rename to .github/scripts/package.json diff --git a/.github/workflows/scripts/package-lock.json b/.github/workflows/scripts/package-lock.json deleted file mode 100644 index db884d99a14b..000000000000 --- a/.github/workflows/scripts/package-lock.json +++ /dev/null @@ -1,468 +0,0 @@ -{ - "name": "scripts", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "devDependencies": { - "@octokit/webhooks-types": "^7.5.1", - "@types/github-script": "github:actions/github-script", - "@types/node": "^20.0.0" - } - }, - "node_modules/@actions/core": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", - "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/http-client": "^2.0.1", - "uuid": "^8.3.2" - } - }, - "node_modules/@actions/exec": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", - "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/io": "^1.0.1" - } - }, - "node_modules/@actions/github": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", - "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/http-client": "^2.2.0", - "@octokit/core": "^5.0.1", - "@octokit/plugin-paginate-rest": "^9.0.0", - "@octokit/plugin-rest-endpoint-methods": "^10.0.0" - } - }, - "node_modules/@actions/glob": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.4.0.tgz", - "integrity": "sha512-+eKIGFhsFa4EBwaf/GMyzCdWrXWymGXfFmZU3FHQvYS8mPcHtTtZONbkcqqUMzw9mJ/pImEBFET1JNifhqGsAQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/core": "^1.9.1", - "minimatch": "^3.0.4" - } - }, - "node_modules/@actions/http-client": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", - "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", - "dev": true, - "license": "MIT", - "dependencies": { - "tunnel": "^0.0.6", - "undici": "^5.25.4" - } - }, - "node_modules/@actions/io": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", - "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/@fastify/busboy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14" - } - }, - "node_modules/@octokit/auth-token": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", - "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/core": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", - "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/auth-token": "^4.0.0", - "@octokit/graphql": "^7.1.0", - "@octokit/request": "^8.3.1", - "@octokit/request-error": "^5.1.0", - "@octokit/types": "^13.0.0", - "before-after-hook": "^2.2.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/endpoint": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", - "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^13.1.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/graphql": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", - "integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/request": "^8.3.0", - "@octokit/types": "^13.0.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/openapi-types": { - "version": "22.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", - "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-paginate-rest": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", - "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^12.6.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "5" - } - }, - "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", - "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", - "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^20.0.0" - } - }, - "node_modules/@octokit/plugin-request-log": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", - "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "5" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", - "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^12.6.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "5" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", - "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", - "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^20.0.0" - } - }, - "node_modules/@octokit/plugin-retry": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.1.tgz", - "integrity": "sha512-SKs+Tz9oj0g4p28qkZwl/topGcb0k0qPNX/i7vBKmDsjoeqnVfFUquqrE/O9oJY7+oLzdCtkiWSXLpLjvl6uog==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/request-error": "^5.0.0", - "@octokit/types": "^12.0.0", - "bottleneck": "^2.15.3" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=5" - } - }, - "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", - "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", - "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^20.0.0" - } - }, - "node_modules/@octokit/request": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", - "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/endpoint": "^9.0.1", - "@octokit/request-error": "^5.1.0", - "@octokit/types": "^13.1.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/request-error": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", - "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^13.1.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/types": { - "version": "13.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.0.tgz", - "integrity": "sha512-CrooV/vKCXqwLa+osmHLIMUb87brpgUqlqkPGc6iE2wCkUvTrHiXFMhAKoDDaAAYJrtKtrFTgSQTg5nObBEaew==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^22.2.0" - } - }, - "node_modules/@octokit/webhooks-types": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.5.1.tgz", - "integrity": "sha512-1dozxWEP8lKGbtEu7HkRbK1F/nIPuJXNfT0gd96y6d3LcHZTtRtlf8xz3nicSJfesADxJyDh+mWBOsdLkqgzYw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/github-script": { - "name": "github-script", - "version": "7.0.1", - "resolved": "git+ssh://git@github.com/actions/github-script.git#660ec11d825b714d112a6bb9727086bc2cc500b2", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/core": "^1.10.1", - "@actions/exec": "^1.1.1", - "@actions/github": "^6.0.0", - "@actions/glob": "^0.4.0", - "@actions/io": "^1.1.3", - "@octokit/core": "^5.0.1", - "@octokit/plugin-request-log": "^4.0.0", - "@octokit/plugin-retry": "^6.0.1", - "@types/node": "^20.9.0" - }, - "engines": { - "node": ">=20.0.0 <21.0.0" - } - }, - "node_modules/@types/node": { - "version": "20.16.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.10.tgz", - "integrity": "sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~6.19.2" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/before-after-hook": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", - "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/bottleneck": { - "version": "2.19.5", - "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", - "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", - "dev": true, - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, - "node_modules/deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - }, - "node_modules/undici": { - "version": "5.28.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", - "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, - "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT" - }, - "node_modules/universal-user-agent": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", - "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true, - "license": "ISC" - } - } -} diff --git a/.github/workflows/scripts/typespec-requirement-completed.js b/.github/workflows/scripts/typespec-requirement-completed.js deleted file mode 100644 index 8a11168b5616..000000000000 --- a/.github/workflows/scripts/typespec-requirement-completed.js +++ /dev/null @@ -1,86 +0,0 @@ -// @ts-check - -const { addLabelIfNotExists, removeLabelIfExists } = require("./util"); - -/** - * @param {import('github-script').AsyncFunctionArguments["github"]} github - * @param {import('github-script').AsyncFunctionArguments["context"]} context - * @param {import('github-script').AsyncFunctionArguments["core"]} core - */ -module.exports = async (github, context, core) => { - console.log("context: " + JSON.stringify(context, null, 2)); - - if (context.eventName !== "workflow_run" || context.action == "completed") { - throw new Error( - `Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`, - ); - } - - const payload = - /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( - context.payload - ); - - const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: payload.workflow_run.repository.owner.login, - repo: payload.workflow_run.repository.name, - run_id: payload.workflow_run.id, - }); - - console.log("artifacts: " + JSON.stringify(artifacts, null, 2)); - - const artifactNames = artifacts.data.artifacts.map((a) => a.name); - - const label = "brownfield"; - if ( - artifactNames.includes("spec-lifecycle-data-plane=brownfield") || - artifactNames.includes("spec-lifecycle-resource-manager=brownfield") - ) { - await addLabelIfNotExists( - github, - context, - core, - label, - ); - } else { - await removeLabelIfExists(github, context, core, label); - } - - // const owner = payload.workflow_run.head_repository.owner.login; - // const repo = payload.workflow_run.head_repository.name; - // const sha = payload.workflow_run.head_sha; - - // console.log(`Finding pull requests for '/${owner}/${repo}/${sha}'`); - - // (property) listPullRequestsAssociatedWithCommit: { - // parameters: RequestParameters & Endpoints["GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"]["parameters"]; - // response: Endpoints["GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"]["response"]; - // } - - // Must call this API, since 'payload.workflow_run.pull_requests' is empty for fork PRs - // Must use 'head_repository' instead of 'repository', - // const { data: pullRequests } = - // await github.rest.repos.listPullRequestsAssociatedWithCommit({ - // owner: owner, - // repo: repo, - // commit_sha: sha, - // }); - - // console.log(`Found ${pullRequests.length}`); - // if (pullRequests.length === 0) { - // console.log("No pull request associated with this commit."); - // } else if (pullRequests.length === 1) { - // const prNumber = pullRequests[0].number; - // await github.rest.issues.addLabels({ - // owner: context.repo.owner, - // repo: context.repo.repo, - // issue_number: prNumber, - // labels: ["pull-request-completed"], - // }); - // } else { - // console.log("Too many pull requests associated with this commit."); - // } - // } else { - // console.log("Not adding label 'pull-request-completed'"); - // } -}; diff --git a/.github/workflows/scripts/util.js b/.github/workflows/scripts/util.js deleted file mode 100644 index d12f15e2cff4..000000000000 --- a/.github/workflows/scripts/util.js +++ /dev/null @@ -1,105 +0,0 @@ -// @ts-check - -module.exports = { - addLabelIfNotExists, - group, - removeLabelIfExists, -}; - -// /** @type {Map>} */ -// const labelCache = new Map(); - -/** - * @param {import('github-script').AsyncFunctionArguments["github"]} github - * @param {import('github-script').AsyncFunctionArguments["context"]} context - * @param {import('github-script').AsyncFunctionArguments["core"]} core - * @param {string} name - * @returns {Promise} - */ -async function addLabelIfNotExists(github, context, core, name) { -// await group(`addLabelIfNotExists("${name}")`, async () => { -// // TODO: Add support for workflow_run from a pull_request context -// if (!context.payload.pull_request) { -// throw new Error("May only run in context of a pull request"); -// } - -// if (await hasLabel(github, context, name)) { -// console.log(`Already has label '${name}'`); -// return; -// } - -// core.notice(`Adding label '${name}'`); - -// const prNumber = context.payload.pull_request.number; -// const { data: labels } = await github.rest.issues.addLabels({ -// owner: context.repo.owner, -// repo: context.repo.repo, -// issue_number: prNumber, -// labels: [name], -// }); - -// const labelNames = new Set(labels.map((l) => l.name)); -// labelCache.set(prNumber, labelNames); -// }); -} - -/** - * Wrap an async function in a log group - * - * @template T - * @param {string} name - * @param {() => Promise} fn - */ -async function group(name, fn) { - // Uses console.group() instead of @actions/core.group() which doesn't support nesting - console.group(name); - try { - return await fn(); - } finally { - console.groupEnd(); - } -} - -/** - * @param {import('github-script').AsyncFunctionArguments["github"]} github - * @param {import('github-script').AsyncFunctionArguments["context"]} context - * @param {import('github-script').AsyncFunctionArguments["core"]} core - * @param {string} name - * @returns {Promise} - */ -async function removeLabelIfExists(github, context, core, name) { -// await group(`removeLabelIfExists("${name}")`, async () => { -// if (!context.payload.pull_request) { -// throw new Error("May only run in context of a pull request"); -// } - -// if (!(await hasLabel(github, context, name))) { -// console.log(`Does not have label '${name}'`); -// return; -// } - -// core.notice(`Removing label '${name}'`); - -// const prNumber = context.payload.pull_request.number; -// try { -// const {data: labels} = await github.rest.issues.removeLabel({ -// owner: context.repo.owner, -// repo: context.repo.repo, -// issue_number: prNumber, -// name: name, -// }); - -// const labelNames = new Set(labels.map((l) => l.name)); -// labelCache.set(prNumber, labelNames); -// } catch (error) { -// /** @type {import("@octokit/request-error").RequestError} */ -// const requestError = error; - -// if (requestError.status == 404) { -// // Label does not exist -// } else { -// throw error; -// } -// } -// }); -} diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index 5676be23947d..492e7e6a3213 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -19,11 +19,14 @@ jobs: - uses: actions/checkout@v4 with: sparse-checkout: | - .github/workflows + .github - - name: Add label if artifact - uses: actions/github-script@v7 - with: - script: | - const typespecRequirementCompleted = require('./.github/workflows/scripts/typespec-requirement-completed.js') - await typespecRequirementCompleted(github, context, core); + - name: Get keyvalue artifacts + uses: ./.github/actions/get-keyvalue-artifacts + + # - name: Add label if artifact + # uses: actions/github-script@v7 + # with: + # script: | + # const typespecRequirementCompleted = require('./.github/scripts/typespec-requirement-completed.js') + # await typespecRequirementCompleted(github, context, core); From b5437ea7cc59d9e09d2a55ebf0a46b4b38b0ea71 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Sat, 26 Oct 2024 01:41:21 +0000 Subject: [PATCH 19/73] Update scripts path --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b7400e94e3c1..3dfdb1342ad2 100644 --- a/.gitignore +++ b/.gitignore @@ -118,7 +118,7 @@ warnings.txt # Blanket ignores *.js -!.github/workflows/scripts/*.js +!.github/*.js *.d.ts *.js.map *.d.ts.map From bb15740395f4fb1e537566e0243a5fbcc711ceb1 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Thu, 31 Oct 2024 00:45:53 +0000 Subject: [PATCH 20/73] empty commit From e24152e618c58a5ec91d677d23edd88b5b795806 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Thu, 31 Oct 2024 00:57:57 +0000 Subject: [PATCH 21/73] Add script file --- .github/scripts/get-keyvalue-artifacts.js | 6 ++++++ .gitignore | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .github/scripts/get-keyvalue-artifacts.js diff --git a/.github/scripts/get-keyvalue-artifacts.js b/.github/scripts/get-keyvalue-artifacts.js new file mode 100644 index 000000000000..a1469ea6e67e --- /dev/null +++ b/.github/scripts/get-keyvalue-artifacts.js @@ -0,0 +1,6 @@ +// @ts-check + +/** @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ +module.exports = async ({ github, context, core }) => { + core.info("hello world!"); +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3dfdb1342ad2..84e950a61a82 100644 --- a/.gitignore +++ b/.gitignore @@ -118,7 +118,7 @@ warnings.txt # Blanket ignores *.js -!.github/*.js +!.github/**/*.js *.d.ts *.js.map *.d.ts.map From d25046e8a5bf20d610867e3ed9b7f535c710b31a Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Thu, 31 Oct 2024 01:00:37 +0000 Subject: [PATCH 22/73] Pass arguments correctly --- .github/actions/get-keyvalue-artifacts/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/get-keyvalue-artifacts/action.yaml index a39b1970ca07..e4b05d453ffc 100644 --- a/.github/actions/get-keyvalue-artifacts/action.yaml +++ b/.github/actions/get-keyvalue-artifacts/action.yaml @@ -10,4 +10,4 @@ runs: with: script: | const getKeyValueArtifacts = require('./.github/scripts/get-keyvalue-artifacts.js') - await getKeyValueArtifacts(github, context, core); + await getKeyValueArtifacts({ github, context, core }); From b8feceaf2053fd9876ead6bfe5066126bba4dda7 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Thu, 31 Oct 2024 19:00:05 +0000 Subject: [PATCH 23/73] WIP: Implement get-keyvaule-artifacts action --- .../get-keyvalue-artifacts/action.yaml | 17 ++++- .github/scripts/get-keyvalue-artifacts.js | 71 +++++++++++++++++-- .github/scripts/package.json | 3 +- .../typespec-requirement-completed.yaml | 12 +++- 4 files changed, 95 insertions(+), 8 deletions(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/get-keyvalue-artifacts/action.yaml index e4b05d453ffc..1602f8a23423 100644 --- a/.github/actions/get-keyvalue-artifacts/action.yaml +++ b/.github/actions/get-keyvalue-artifacts/action.yaml @@ -1,13 +1,26 @@ name: Get KeyValue Artifacts description: Sets env vars corresponding to keys and values encoded in artifact names +# description: Returns JSON object of keys and values encoded in artifact names + +# If any inputs are not set, we will attempt to extract them from the event context +inputs: + owner: + description: The account owner of the repository. The name is not case sensitive. + required: false + repo: + description: The name of the repository without the .git extension. The name is not case sensitive. + required: false + run_id: + description: The unique identifier of the workflow run. + required: false runs: using: composite steps: - - name: Set env vars from artifact names + - name: Get KeyValue Artifacts uses: actions/github-script@v7 with: script: | const getKeyValueArtifacts = require('./.github/scripts/get-keyvalue-artifacts.js') - await getKeyValueArtifacts({ github, context, core }); + await getKeyValueArtifacts({ github, context, core }, ${{ inputs.owner }}, ${{ inputs.repo }}, ${{ inputs.run_id }}); diff --git a/.github/scripts/get-keyvalue-artifacts.js b/.github/scripts/get-keyvalue-artifacts.js index a1469ea6e67e..0f59b2e81679 100644 --- a/.github/scripts/get-keyvalue-artifacts.js +++ b/.github/scripts/get-keyvalue-artifacts.js @@ -1,6 +1,69 @@ // @ts-check -/** @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ -module.exports = async ({ github, context, core }) => { - core.info("hello world!"); -} \ No newline at end of file +/** + * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments + * @param {string?} owner The account owner of the repository. The name is not case sensitive. + * @param {string?} repo The name of the repository without the .git extension. The name is not case sensitive. + * @param {number?} run_id The unique identifier of the workflow run. + */ +module.exports = async ({ github, context, core }, owner, repo, run_id) => { + console.log("context: " + JSON.stringify(context, null, 2)); + + let params; + + if (owner && repo && run_id) { + params = { + owner: owner, + repo: repo, + run_id: run_id, + }; + } else if (!owner && !repo && !run_id) { + if (context.eventName !== "workflow_run" || context.action == "completed") { + throw new Error( + `Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`, + ); + } + + const payload = + /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( + context.payload + ); + + params = { + owner: payload.workflow_run.repository.owner.login, + repo: payload.workflow_run.repository.name, + run_id: payload.workflow_run.id, + }; + } else { + throw new Error( + "Parameters 'owner', 'repo', and 'run_id' must be all either set or unset", + ); + } + + const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: params.owner, + repo: params.repo, + run_id: params.run_id, + }); + + console.log("artifacts: " + JSON.stringify(artifacts, null, 2)); + + const artifactNames = artifacts.data.artifacts.map((a) => a.name); + + core.exportVariable() + + // const label = "brownfield"; + // if ( + // artifactNames.includes("spec-lifecycle-data-plane=brownfield") || + // artifactNames.includes("spec-lifecycle-resource-manager=brownfield") + // ) { + // await addLabelIfNotExists( + // github, + // context, + // core, + // label, + // ); + // } else { + // await removeLabelIfExists(github, context, core, label); + // } +}; diff --git a/.github/scripts/package.json b/.github/scripts/package.json index 7e450a67224e..87598b90e726 100644 --- a/.github/scripts/package.json +++ b/.github/scripts/package.json @@ -2,6 +2,7 @@ "devDependencies": { "@types/node": "^20.0.0", "@types/github-script": "github:actions/github-script", - "@octokit/webhooks-types":"^7.5.1" + "@octokit/webhooks-types": "^7.5.1", + "prettier": "^3.3.3" } } diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index 492e7e6a3213..d1bb11ad6846 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -4,6 +4,10 @@ on: workflow_run: workflows: ["TypeSpec Requirement"] types: [completed] + workflow_dispatch: + inputs: + logLevel: + description jobs: typespec-requirement-completed: @@ -21,9 +25,15 @@ jobs: sparse-checkout: | .github - - name: Get keyvalue artifacts + - name: Get KeyValue artifacts + id: get-keyvalue-artifacts uses: ./.github/actions/get-keyvalue-artifacts + - name: Add label + if: ${{ fromJSON(steps.get-keyvalue-artifacts.outputs.result).spec-lifecycle-brownfield == 'true' }} + uses: actions/github-script@v7 + + # - name: Add label if artifact # uses: actions/github-script@v7 # with: From ddbb05154cffcb7d443656b0db7ea2e8c5832121 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Thu, 31 Oct 2024 19:12:09 +0000 Subject: [PATCH 24/73] Flow inputs --- .../typespec-requirement-completed.yaml | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index d1bb11ad6846..0c8bca24e924 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -5,9 +5,20 @@ on: workflows: ["TypeSpec Requirement"] types: [completed] workflow_dispatch: + # If any inputs are not set, we will attempt to extract them from the event context inputs: - logLevel: - description + owner: + description: The account owner of the repository. The name is not case sensitive. + required: false + type: string + repo: + description: The name of the repository without the .git extension. The name is not case sensitive. + required: false + type: string + run_id: + description: The unique identifier of the workflow run. + required: false + type: number jobs: typespec-requirement-completed: @@ -25,14 +36,17 @@ jobs: sparse-checkout: | .github - - name: Get KeyValue artifacts - id: get-keyvalue-artifacts + - id: get-keyvalue-artifacts + name: Get KeyValue artifacts uses: ./.github/actions/get-keyvalue-artifacts + with: + owner: ${{ inputs.owner }} + repo: ${{ inputs.repo }} + run_id: ${{ inputs.run_id }} - - name: Add label - if: ${{ fromJSON(steps.get-keyvalue-artifacts.outputs.result).spec-lifecycle-brownfield == 'true' }} - uses: actions/github-script@v7 - + # - if: ${{ fromJSON(steps.get-keyvalue-artifacts.outputs.result).spec-lifecycle-brownfield == 'true' }} + # name: Add label + # uses: actions/github-script@v7 # - name: Add label if artifact # uses: actions/github-script@v7 From 7d699042e1d6972780723b787d37a66efa92e1c9 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Thu, 31 Oct 2024 22:26:22 +0000 Subject: [PATCH 25/73] Pass owner, repo, and run_id via env vars --- .../get-keyvalue-artifacts/action.yaml | 6 +- .github/scripts/get-keyvalue-artifacts.js | 61 ++++++++----------- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/get-keyvalue-artifacts/action.yaml index 1602f8a23423..8b437b2c5ae8 100644 --- a/.github/actions/get-keyvalue-artifacts/action.yaml +++ b/.github/actions/get-keyvalue-artifacts/action.yaml @@ -20,7 +20,11 @@ runs: steps: - name: Get KeyValue Artifacts uses: actions/github-script@v7 + env: + OWNER: ${{ inputs.owner }} + REPO: ${{ inputs.repo }} + RUN_ID: ${{ inputs.run_id }} with: script: | const getKeyValueArtifacts = require('./.github/scripts/get-keyvalue-artifacts.js') - await getKeyValueArtifacts({ github, context, core }, ${{ inputs.owner }}, ${{ inputs.repo }}, ${{ inputs.run_id }}); + await getKeyValueArtifacts({ github, context, core }); diff --git a/.github/scripts/get-keyvalue-artifacts.js b/.github/scripts/get-keyvalue-artifacts.js index 0f59b2e81679..ba004ea5c12e 100644 --- a/.github/scripts/get-keyvalue-artifacts.js +++ b/.github/scripts/get-keyvalue-artifacts.js @@ -2,22 +2,15 @@ /** * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments - * @param {string?} owner The account owner of the repository. The name is not case sensitive. - * @param {string?} repo The name of the repository without the .git extension. The name is not case sensitive. - * @param {number?} run_id The unique identifier of the workflow run. */ -module.exports = async ({ github, context, core }, owner, repo, run_id) => { +module.exports = async ({ github, context, core }) => { console.log("context: " + JSON.stringify(context, null, 2)); - let params; + let owner = process.env.OWNER; + let repo = process.env.REPO; + let run_id = parseInt(process.env.RUN_ID || ""); - if (owner && repo && run_id) { - params = { - owner: owner, - repo: repo, - run_id: run_id, - }; - } else if (!owner && !repo && !run_id) { + if (!owner && !repo && !run_id) { if (context.eventName !== "workflow_run" || context.action == "completed") { throw new Error( `Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`, @@ -29,41 +22,35 @@ module.exports = async ({ github, context, core }, owner, repo, run_id) => { context.payload ); - params = { - owner: payload.workflow_run.repository.owner.login, - repo: payload.workflow_run.repository.name, - run_id: payload.workflow_run.id, - }; - } else { + owner = payload.workflow_run.repository.owner.login; + repo = payload.workflow_run.repository.name; + run_id = payload.workflow_run.id; + } else if (!owner || !repo || !run_id) { throw new Error( "Parameters 'owner', 'repo', and 'run_id' must be all either set or unset", ); } const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: params.owner, - repo: params.repo, - run_id: params.run_id, + owner: owner, + repo: repo, + run_id: run_id, }); console.log("artifacts: " + JSON.stringify(artifacts, null, 2)); const artifactNames = artifacts.data.artifacts.map((a) => a.name); - core.exportVariable() - - // const label = "brownfield"; - // if ( - // artifactNames.includes("spec-lifecycle-data-plane=brownfield") || - // artifactNames.includes("spec-lifecycle-resource-manager=brownfield") - // ) { - // await addLabelIfNotExists( - // github, - // context, - // core, - // label, - // ); - // } else { - // await removeLabelIfExists(github, context, core, label); - // } + for (const artifactName of artifactNames) { + // If artifactName has format `key=value`, add the key and value as env vars. + // If artifactName does not contain "=", ignore. + // If artifactName contains multiple "=", the key is everything before the first "=", + // and the value is everything else. + const firstEquals = artifactName.indexOf("="); + if (firstEquals !== -1) { + const key = artifactName.substring(0, firstEquals); + const value = artifactName.substring(firstEquals + 1); + core.exportVariable(key, value); + } + } }; From 0b7c8996f45c1ab959f3b37e0e9987aae0d51d7d Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Thu, 31 Oct 2024 22:30:11 +0000 Subject: [PATCH 26/73] Print env after setting --- .github/actions/get-keyvalue-artifacts/action.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/get-keyvalue-artifacts/action.yaml index 8b437b2c5ae8..0db092d0149d 100644 --- a/.github/actions/get-keyvalue-artifacts/action.yaml +++ b/.github/actions/get-keyvalue-artifacts/action.yaml @@ -28,3 +28,7 @@ runs: script: | const getKeyValueArtifacts = require('./.github/scripts/get-keyvalue-artifacts.js') await getKeyValueArtifacts({ github, context, core }); + + # TODO: Remove before merge + - run: printenv + shell: bash From 1f393ca7788108a252177210aca5247fbc9ed975 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Thu, 31 Oct 2024 22:35:54 +0000 Subject: [PATCH 27/73] Use env var --- .github/workflows/typespec-requirement-completed.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index 0c8bca24e924..d265097b3fc3 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -44,6 +44,10 @@ jobs: repo: ${{ inputs.repo }} run_id: ${{ inputs.run_id }} + # TODO: Add label + - if: env.spec-lifecycle-resource-manager == 'brownfield' + run: echo "brownfield" + # - if: ${{ fromJSON(steps.get-keyvalue-artifacts.outputs.result).spec-lifecycle-brownfield == 'true' }} # name: Add label # uses: actions/github-script@v7 From c51e80645567bd76db1f5a4c4830fdad37729ab0 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 1 Nov 2024 20:56:41 +0000 Subject: [PATCH 28/73] Re-organize .github folder --- .../get-keyvalue-artifacts/action.js} | 0 .../get-keyvalue-artifacts/action.yaml | 4 +- .github/package-lock.json | 475 ++++++++++++++++++ .github/{scripts => }/package.json | 0 .gitignore | 4 +- 5 files changed, 479 insertions(+), 4 deletions(-) rename .github/{scripts/get-keyvalue-artifacts.js => actions/get-keyvalue-artifacts/action.js} (100%) create mode 100644 .github/package-lock.json rename .github/{scripts => }/package.json (100%) diff --git a/.github/scripts/get-keyvalue-artifacts.js b/.github/actions/get-keyvalue-artifacts/action.js similarity index 100% rename from .github/scripts/get-keyvalue-artifacts.js rename to .github/actions/get-keyvalue-artifacts/action.js diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/get-keyvalue-artifacts/action.yaml index 0db092d0149d..1ff38d83435d 100644 --- a/.github/actions/get-keyvalue-artifacts/action.yaml +++ b/.github/actions/get-keyvalue-artifacts/action.yaml @@ -26,8 +26,8 @@ runs: RUN_ID: ${{ inputs.run_id }} with: script: | - const getKeyValueArtifacts = require('./.github/scripts/get-keyvalue-artifacts.js') - await getKeyValueArtifacts({ github, context, core }); + const action = require('./.github/actions/get-keyvalue-artifacts/action.js') + await action({ github, context, core }); # TODO: Remove before merge - run: printenv diff --git a/.github/package-lock.json b/.github/package-lock.json new file mode 100644 index 000000000000..9bf44423ccfa --- /dev/null +++ b/.github/package-lock.json @@ -0,0 +1,475 @@ +{ + "name": "scripts", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@octokit/webhooks-types": "^7.5.1", + "@types/github-script": "github:actions/github-script", + "@types/node": "^20.0.0", + "prettier": "^3.3.3" + } + }, + "node_modules/@actions/core": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz", + "integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/exec": "^1.1.1", + "@actions/http-client": "^2.0.1" + } + }, + "node_modules/@actions/exec": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", + "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/io": "^1.0.1" + } + }, + "node_modules/@actions/github": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", + "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/http-client": "^2.2.0", + "@octokit/core": "^5.0.1", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + } + }, + "node_modules/@actions/glob": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.4.0.tgz", + "integrity": "sha512-+eKIGFhsFa4EBwaf/GMyzCdWrXWymGXfFmZU3FHQvYS8mPcHtTtZONbkcqqUMzw9mJ/pImEBFET1JNifhqGsAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/core": "^1.9.1", + "minimatch": "^3.0.4" + } + }, + "node_modules/@actions/http-client": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", + "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "node_modules/@actions/io": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", + "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", + "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.1.0", + "@octokit/request": "^8.3.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", + "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", + "integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request": "^8.3.0", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", + "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", + "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-request-log": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", + "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", + "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-retry": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.1.tgz", + "integrity": "sha512-SKs+Tz9oj0g4p28qkZwl/topGcb0k0qPNX/i7vBKmDsjoeqnVfFUquqrE/O9oJY7+oLzdCtkiWSXLpLjvl6uog==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^12.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=5" + } + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/request": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", + "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^9.0.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", + "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/types": { + "version": "13.6.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.1.tgz", + "integrity": "sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^22.2.0" + } + }, + "node_modules/@octokit/webhooks-types": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.6.1.tgz", + "integrity": "sha512-S8u2cJzklBC0FgTwWVLaM8tMrDuDMVE4xiTK4EYXM9GntyvrdbSoxqDQa+Fh57CCNApyIpyeqPhhFEmHPfrXgw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/github-script": { + "name": "github-script", + "version": "7.0.1", + "resolved": "git+ssh://git@github.com/actions/github-script.git#660ec11d825b714d112a6bb9727086bc2cc500b2", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/core": "^1.10.1", + "@actions/exec": "^1.1.1", + "@actions/github": "^6.0.0", + "@actions/glob": "^0.4.0", + "@actions/io": "^1.1.3", + "@octokit/core": "^5.0.1", + "@octokit/plugin-request-log": "^4.0.0", + "@octokit/plugin-retry": "^6.0.1", + "@types/node": "^20.9.0" + }, + "engines": { + "node": ">=20.0.0 <21.0.0" + } + }, + "node_modules/@types/node": { + "version": "20.17.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.3.tgz", + "integrity": "sha512-tSQrmKKatLDGnG92h40GD7FzUt0MjahaHwOME4VAFeeA/Xopayq5qLyQRy7Jg/pjgKIFBXuKcGhJo+UdYG55jQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" + }, + "node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + } + } +} diff --git a/.github/scripts/package.json b/.github/package.json similarity index 100% rename from .github/scripts/package.json rename to .github/package.json diff --git a/.gitignore b/.gitignore index 84e950a61a82..b07c3b3ae14e 100644 --- a/.gitignore +++ b/.gitignore @@ -132,10 +132,10 @@ eng/tools/**/dist # TypeScript cache *.tsbuildinfo -# No package-lock.json files should be commited except the top-level. +# No package-lock.json files should be commited except the top-level and .github **/package-lock.json !/package-lock.json -!/.github/workflows/scripts/package-lock.json +!/.github/package-lock.json # No Armstrong outputs should be commited except the tf files. **/terraform/**/*.json From 1a2d21740d2edc2e2aef594a9584b68db709a32c Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 1 Nov 2024 21:09:45 +0000 Subject: [PATCH 29/73] Add .github to root package.json --- .github/package-lock.json | 475 -------------------------------------- package-lock.json | 421 ++++++++++++++++++++++++++++++++- package.json | 1 + 3 files changed, 412 insertions(+), 485 deletions(-) delete mode 100644 .github/package-lock.json diff --git a/.github/package-lock.json b/.github/package-lock.json deleted file mode 100644 index 9bf44423ccfa..000000000000 --- a/.github/package-lock.json +++ /dev/null @@ -1,475 +0,0 @@ -{ - "name": "scripts", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "devDependencies": { - "@octokit/webhooks-types": "^7.5.1", - "@types/github-script": "github:actions/github-script", - "@types/node": "^20.0.0", - "prettier": "^3.3.3" - } - }, - "node_modules/@actions/core": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz", - "integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/exec": "^1.1.1", - "@actions/http-client": "^2.0.1" - } - }, - "node_modules/@actions/exec": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", - "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/io": "^1.0.1" - } - }, - "node_modules/@actions/github": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", - "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/http-client": "^2.2.0", - "@octokit/core": "^5.0.1", - "@octokit/plugin-paginate-rest": "^9.0.0", - "@octokit/plugin-rest-endpoint-methods": "^10.0.0" - } - }, - "node_modules/@actions/glob": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.4.0.tgz", - "integrity": "sha512-+eKIGFhsFa4EBwaf/GMyzCdWrXWymGXfFmZU3FHQvYS8mPcHtTtZONbkcqqUMzw9mJ/pImEBFET1JNifhqGsAQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/core": "^1.9.1", - "minimatch": "^3.0.4" - } - }, - "node_modules/@actions/http-client": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", - "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", - "dev": true, - "license": "MIT", - "dependencies": { - "tunnel": "^0.0.6", - "undici": "^5.25.4" - } - }, - "node_modules/@actions/io": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", - "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/@fastify/busboy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14" - } - }, - "node_modules/@octokit/auth-token": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", - "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/core": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", - "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/auth-token": "^4.0.0", - "@octokit/graphql": "^7.1.0", - "@octokit/request": "^8.3.1", - "@octokit/request-error": "^5.1.0", - "@octokit/types": "^13.0.0", - "before-after-hook": "^2.2.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/endpoint": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", - "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^13.1.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/graphql": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", - "integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/request": "^8.3.0", - "@octokit/types": "^13.0.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/openapi-types": { - "version": "22.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", - "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-paginate-rest": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", - "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^12.6.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "5" - } - }, - "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", - "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", - "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^20.0.0" - } - }, - "node_modules/@octokit/plugin-request-log": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", - "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "5" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", - "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^12.6.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "5" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", - "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", - "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^20.0.0" - } - }, - "node_modules/@octokit/plugin-retry": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.1.tgz", - "integrity": "sha512-SKs+Tz9oj0g4p28qkZwl/topGcb0k0qPNX/i7vBKmDsjoeqnVfFUquqrE/O9oJY7+oLzdCtkiWSXLpLjvl6uog==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/request-error": "^5.0.0", - "@octokit/types": "^12.0.0", - "bottleneck": "^2.15.3" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=5" - } - }, - "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", - "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", - "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^20.0.0" - } - }, - "node_modules/@octokit/request": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", - "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/endpoint": "^9.0.1", - "@octokit/request-error": "^5.1.0", - "@octokit/types": "^13.1.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/request-error": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", - "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^13.1.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/types": { - "version": "13.6.1", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.1.tgz", - "integrity": "sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^22.2.0" - } - }, - "node_modules/@octokit/webhooks-types": { - "version": "7.6.1", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.6.1.tgz", - "integrity": "sha512-S8u2cJzklBC0FgTwWVLaM8tMrDuDMVE4xiTK4EYXM9GntyvrdbSoxqDQa+Fh57CCNApyIpyeqPhhFEmHPfrXgw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/github-script": { - "name": "github-script", - "version": "7.0.1", - "resolved": "git+ssh://git@github.com/actions/github-script.git#660ec11d825b714d112a6bb9727086bc2cc500b2", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/core": "^1.10.1", - "@actions/exec": "^1.1.1", - "@actions/github": "^6.0.0", - "@actions/glob": "^0.4.0", - "@actions/io": "^1.1.3", - "@octokit/core": "^5.0.1", - "@octokit/plugin-request-log": "^4.0.0", - "@octokit/plugin-retry": "^6.0.1", - "@types/node": "^20.9.0" - }, - "engines": { - "node": ">=20.0.0 <21.0.0" - } - }, - "node_modules/@types/node": { - "version": "20.17.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.3.tgz", - "integrity": "sha512-tSQrmKKatLDGnG92h40GD7FzUt0MjahaHwOME4VAFeeA/Xopayq5qLyQRy7Jg/pjgKIFBXuKcGhJo+UdYG55jQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~6.19.2" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/before-after-hook": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", - "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/bottleneck": { - "version": "2.19.5", - "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", - "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", - "dev": true, - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, - "node_modules/deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - }, - "node_modules/undici": { - "version": "5.28.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", - "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, - "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT" - }, - "node_modules/universal-user-agent": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", - "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true, - "license": "ISC" - } - } -} diff --git a/package-lock.json b/package-lock.json index 97b673994411..0f3004d9f139 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "@typespec/streams": "0.62.0", "@typespec/versioning": "0.62.0", "azure-rest-api-specs-eng-tools": "file:eng/tools", + "github": "file:.github", "oav": "^3.5.1", "prettier": "~3.3.3", "typescript": "~5.6.2" @@ -34,6 +35,32 @@ "npm": ">=9.0.0" } }, + ".github": { + "dev": true, + "devDependencies": { + "@octokit/webhooks-types": "^7.5.1", + "@types/github-script": "github:actions/github-script", + "@types/node": "^20.0.0", + "prettier": "^3.3.3" + } + }, + ".github/node_modules/@types/node": { + "version": "20.17.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.5.tgz", + "integrity": "sha512-n8FYY/pRxu496441gIcAQFZPKXbhsd6VZygcq+PTSZ75eMh/Ke0hCAROdUa21qiFqKNsPPYic46yXDO1JGiPBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + ".github/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" + }, "eng/tools": { "name": "azure-rest-api-specs-eng-tools", "dev": true, @@ -367,6 +394,69 @@ "node": ">= 18.0.0" } }, + "node_modules/@actions/core": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz", + "integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/exec": "^1.1.1", + "@actions/http-client": "^2.0.1" + } + }, + "node_modules/@actions/exec": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", + "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/io": "^1.0.1" + } + }, + "node_modules/@actions/github": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", + "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/http-client": "^2.2.0", + "@octokit/core": "^5.0.1", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + } + }, + "node_modules/@actions/glob": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.4.0.tgz", + "integrity": "sha512-+eKIGFhsFa4EBwaf/GMyzCdWrXWymGXfFmZU3FHQvYS8mPcHtTtZONbkcqqUMzw9mJ/pImEBFET1JNifhqGsAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/core": "^1.9.1", + "minimatch": "^3.0.4" + } + }, + "node_modules/@actions/http-client": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", + "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "node_modules/@actions/io": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", + "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", @@ -1980,20 +2070,21 @@ "dev": true, "license": "MIT" }, - "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", "dev": true, - "license": "Apache-2.0", + "license": "MIT", "engines": { - "node": ">=18.18.0" + "node": ">=14" } }, - "node_modules/@humanfs/node": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", - "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -2310,6 +2401,233 @@ "node": ">= 8" } }, + "node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", + "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.1.0", + "@octokit/request": "^8.3.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", + "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", + "integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request": "^8.3.0", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", + "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", + "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-request-log": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", + "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", + "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-retry": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.1.tgz", + "integrity": "sha512-SKs+Tz9oj0g4p28qkZwl/topGcb0k0qPNX/i7vBKmDsjoeqnVfFUquqrE/O9oJY7+oLzdCtkiWSXLpLjvl6uog==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^12.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=5" + } + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/request": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", + "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^9.0.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", + "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/types": { + "version": "13.6.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.1.tgz", + "integrity": "sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^22.2.0" + } + }, + "node_modules/@octokit/webhooks-types": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.6.1.tgz", + "integrity": "sha512-S8u2cJzklBC0FgTwWVLaM8tMrDuDMVE4xiTK4EYXM9GntyvrdbSoxqDQa+Fh57CCNApyIpyeqPhhFEmHPfrXgw==", + "dev": true, + "license": "MIT" + }, "node_modules/@opentelemetry/api": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", @@ -3061,6 +3379,44 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/github-script": { + "name": "github-script", + "version": "7.0.1", + "resolved": "git+ssh://git@github.com/actions/github-script.git#660ec11d825b714d112a6bb9727086bc2cc500b2", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/core": "^1.10.1", + "@actions/exec": "^1.1.1", + "@actions/github": "^6.0.0", + "@actions/glob": "^0.4.0", + "@actions/io": "^1.1.3", + "@octokit/core": "^5.0.1", + "@octokit/plugin-request-log": "^4.0.0", + "@octokit/plugin-retry": "^6.0.1", + "@types/node": "^20.9.0" + }, + "engines": { + "node": ">=20.0.0 <21.0.0" + } + }, + "node_modules/@types/github-script/node_modules/@types/node": { + "version": "20.17.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.5.tgz", + "integrity": "sha512-n8FYY/pRxu496441gIcAQFZPKXbhsd6VZygcq+PTSZ75eMh/Ke0hCAROdUa21qiFqKNsPPYic46yXDO1JGiPBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@types/github-script/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -3897,6 +4253,13 @@ "tweetnacl": "^0.14.3" } }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/bluebird": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", @@ -3904,6 +4267,13 @@ "dev": true, "license": "MIT" }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true, + "license": "MIT" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4521,6 +4891,13 @@ "node": ">=0.4.0" } }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true, + "license": "ISC" + }, "node_modules/des.js": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", @@ -5589,6 +5966,10 @@ "assert-plus": "^1.0.0" } }, + "node_modules/github": { + "resolved": ".github", + "link": true + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -9185,6 +9566,19 @@ "dev": true, "license": "MIT" }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, "node_modules/undici-types": { "version": "5.28.4", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.28.4.tgz", @@ -9205,6 +9599,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true, + "license": "ISC" + }, "node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", diff --git a/package.json b/package.json index 722756e00be5..6d8cd5901380 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@typespec/streams": "0.62.0", "@typespec/versioning": "0.62.0", "azure-rest-api-specs-eng-tools": "file:eng/tools", + "github":"file:.github", "oav": "^3.5.1", "prettier": "~3.3.3", "typescript": "~5.6.2" From 616a59aeaf4c1cdc08a24ffd0cff37b749170ba6 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 4 Nov 2024 22:11:40 +0000 Subject: [PATCH 30/73] Revert "Add .github to root package.json" This reverts commit 1bd3939bc944dc23a10aff50eeba51479509732b. --- .github/package-lock.json | 475 ++++++++++++++++++++++++++++++++++++++ package-lock.json | 416 +-------------------------------- package.json | 1 - 3 files changed, 480 insertions(+), 412 deletions(-) create mode 100644 .github/package-lock.json diff --git a/.github/package-lock.json b/.github/package-lock.json new file mode 100644 index 000000000000..9bf44423ccfa --- /dev/null +++ b/.github/package-lock.json @@ -0,0 +1,475 @@ +{ + "name": "scripts", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@octokit/webhooks-types": "^7.5.1", + "@types/github-script": "github:actions/github-script", + "@types/node": "^20.0.0", + "prettier": "^3.3.3" + } + }, + "node_modules/@actions/core": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz", + "integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/exec": "^1.1.1", + "@actions/http-client": "^2.0.1" + } + }, + "node_modules/@actions/exec": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", + "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/io": "^1.0.1" + } + }, + "node_modules/@actions/github": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", + "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/http-client": "^2.2.0", + "@octokit/core": "^5.0.1", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + } + }, + "node_modules/@actions/glob": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.4.0.tgz", + "integrity": "sha512-+eKIGFhsFa4EBwaf/GMyzCdWrXWymGXfFmZU3FHQvYS8mPcHtTtZONbkcqqUMzw9mJ/pImEBFET1JNifhqGsAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/core": "^1.9.1", + "minimatch": "^3.0.4" + } + }, + "node_modules/@actions/http-client": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", + "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "node_modules/@actions/io": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", + "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", + "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.1.0", + "@octokit/request": "^8.3.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", + "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", + "integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request": "^8.3.0", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", + "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", + "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-request-log": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", + "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", + "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-retry": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.1.tgz", + "integrity": "sha512-SKs+Tz9oj0g4p28qkZwl/topGcb0k0qPNX/i7vBKmDsjoeqnVfFUquqrE/O9oJY7+oLzdCtkiWSXLpLjvl6uog==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^12.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=5" + } + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/request": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", + "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^9.0.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", + "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/types": { + "version": "13.6.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.1.tgz", + "integrity": "sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^22.2.0" + } + }, + "node_modules/@octokit/webhooks-types": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.6.1.tgz", + "integrity": "sha512-S8u2cJzklBC0FgTwWVLaM8tMrDuDMVE4xiTK4EYXM9GntyvrdbSoxqDQa+Fh57CCNApyIpyeqPhhFEmHPfrXgw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/github-script": { + "name": "github-script", + "version": "7.0.1", + "resolved": "git+ssh://git@github.com/actions/github-script.git#660ec11d825b714d112a6bb9727086bc2cc500b2", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/core": "^1.10.1", + "@actions/exec": "^1.1.1", + "@actions/github": "^6.0.0", + "@actions/glob": "^0.4.0", + "@actions/io": "^1.1.3", + "@octokit/core": "^5.0.1", + "@octokit/plugin-request-log": "^4.0.0", + "@octokit/plugin-retry": "^6.0.1", + "@types/node": "^20.9.0" + }, + "engines": { + "node": ">=20.0.0 <21.0.0" + } + }, + "node_modules/@types/node": { + "version": "20.17.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.3.tgz", + "integrity": "sha512-tSQrmKKatLDGnG92h40GD7FzUt0MjahaHwOME4VAFeeA/Xopayq5qLyQRy7Jg/pjgKIFBXuKcGhJo+UdYG55jQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" + }, + "node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + } + } +} diff --git a/package-lock.json b/package-lock.json index 0f3004d9f139..8817f8061a76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,6 @@ "@typespec/streams": "0.62.0", "@typespec/versioning": "0.62.0", "azure-rest-api-specs-eng-tools": "file:eng/tools", - "github": "file:.github", "oav": "^3.5.1", "prettier": "~3.3.3", "typescript": "~5.6.2" @@ -35,36 +34,9 @@ "npm": ">=9.0.0" } }, - ".github": { - "dev": true, - "devDependencies": { - "@octokit/webhooks-types": "^7.5.1", - "@types/github-script": "github:actions/github-script", - "@types/node": "^20.0.0", - "prettier": "^3.3.3" - } - }, - ".github/node_modules/@types/node": { - "version": "20.17.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.5.tgz", - "integrity": "sha512-n8FYY/pRxu496441gIcAQFZPKXbhsd6VZygcq+PTSZ75eMh/Ke0hCAROdUa21qiFqKNsPPYic46yXDO1JGiPBQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~6.19.2" - } - }, - ".github/node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT" - }, "eng/tools": { "name": "azure-rest-api-specs-eng-tools", "dev": true, - "hasInstallScript": true, "devDependencies": { "@azure-tools/specs-model": "file:specs-model", "@azure-tools/suppressions": "file:suppressions", @@ -305,6 +277,7 @@ "eng/tools/specs-model": { "name": "@azure-tools/specs-model", "dev": true, + "hasInstallScript": true, "bin": { "get-specs-model": "cmd/get-specs-model.js" }, @@ -327,6 +300,7 @@ "eng/tools/suppressions": { "name": "@azure-tools/suppressions", "dev": true, + "hasInstallScript": true, "dependencies": { "minimatch": "^9.0.4", "yaml": "^2.4.2", @@ -349,6 +323,7 @@ "eng/tools/tsp-client-tests": { "name": "@azure-tools/tsp-client-tests", "dev": true, + "hasInstallScript": true, "devDependencies": { "@types/node": "^18.19.31", "execa": "^9.3.0", @@ -362,6 +337,7 @@ "eng/tools/typespec-requirement": { "name": "@azure-tools/typespec-requirement", "dev": true, + "hasInstallScript": true, "devDependencies": { "@types/node": "^18.19.31", "execa": "^9.3.0", @@ -375,6 +351,7 @@ "eng/tools/typespec-validation": { "name": "@azure-tools/typespec-validation", "dev": true, + "hasInstallScript": true, "dependencies": { "globby": "^14.0.1", "simple-git": "^3.24.0", @@ -394,69 +371,6 @@ "node": ">= 18.0.0" } }, - "node_modules/@actions/core": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz", - "integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/exec": "^1.1.1", - "@actions/http-client": "^2.0.1" - } - }, - "node_modules/@actions/exec": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", - "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/io": "^1.0.1" - } - }, - "node_modules/@actions/github": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", - "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/http-client": "^2.2.0", - "@octokit/core": "^5.0.1", - "@octokit/plugin-paginate-rest": "^9.0.0", - "@octokit/plugin-rest-endpoint-methods": "^10.0.0" - } - }, - "node_modules/@actions/glob": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.4.0.tgz", - "integrity": "sha512-+eKIGFhsFa4EBwaf/GMyzCdWrXWymGXfFmZU3FHQvYS8mPcHtTtZONbkcqqUMzw9mJ/pImEBFET1JNifhqGsAQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/core": "^1.9.1", - "minimatch": "^3.0.4" - } - }, - "node_modules/@actions/http-client": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", - "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", - "dev": true, - "license": "MIT", - "dependencies": { - "tunnel": "^0.0.6", - "undici": "^5.25.4" - } - }, - "node_modules/@actions/io": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", - "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", - "dev": true, - "license": "MIT" - }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", @@ -2070,16 +1984,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@fastify/busboy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", @@ -2401,233 +2305,6 @@ "node": ">= 8" } }, - "node_modules/@octokit/auth-token": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", - "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/core": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", - "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/auth-token": "^4.0.0", - "@octokit/graphql": "^7.1.0", - "@octokit/request": "^8.3.1", - "@octokit/request-error": "^5.1.0", - "@octokit/types": "^13.0.0", - "before-after-hook": "^2.2.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/endpoint": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", - "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^13.1.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/graphql": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", - "integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/request": "^8.3.0", - "@octokit/types": "^13.0.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/openapi-types": { - "version": "22.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", - "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-paginate-rest": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", - "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^12.6.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "5" - } - }, - "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", - "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", - "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^20.0.0" - } - }, - "node_modules/@octokit/plugin-request-log": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", - "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "5" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", - "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^12.6.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "5" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", - "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", - "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^20.0.0" - } - }, - "node_modules/@octokit/plugin-retry": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.1.tgz", - "integrity": "sha512-SKs+Tz9oj0g4p28qkZwl/topGcb0k0qPNX/i7vBKmDsjoeqnVfFUquqrE/O9oJY7+oLzdCtkiWSXLpLjvl6uog==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/request-error": "^5.0.0", - "@octokit/types": "^12.0.0", - "bottleneck": "^2.15.3" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=5" - } - }, - "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", - "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", - "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^20.0.0" - } - }, - "node_modules/@octokit/request": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", - "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/endpoint": "^9.0.1", - "@octokit/request-error": "^5.1.0", - "@octokit/types": "^13.1.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/request-error": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", - "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^13.1.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/types": { - "version": "13.6.1", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.1.tgz", - "integrity": "sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^22.2.0" - } - }, - "node_modules/@octokit/webhooks-types": { - "version": "7.6.1", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.6.1.tgz", - "integrity": "sha512-S8u2cJzklBC0FgTwWVLaM8tMrDuDMVE4xiTK4EYXM9GntyvrdbSoxqDQa+Fh57CCNApyIpyeqPhhFEmHPfrXgw==", - "dev": true, - "license": "MIT" - }, "node_modules/@opentelemetry/api": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", @@ -3379,44 +3056,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/github-script": { - "name": "github-script", - "version": "7.0.1", - "resolved": "git+ssh://git@github.com/actions/github-script.git#660ec11d825b714d112a6bb9727086bc2cc500b2", - "dev": true, - "license": "MIT", - "dependencies": { - "@actions/core": "^1.10.1", - "@actions/exec": "^1.1.1", - "@actions/github": "^6.0.0", - "@actions/glob": "^0.4.0", - "@actions/io": "^1.1.3", - "@octokit/core": "^5.0.1", - "@octokit/plugin-request-log": "^4.0.0", - "@octokit/plugin-retry": "^6.0.1", - "@types/node": "^20.9.0" - }, - "engines": { - "node": ">=20.0.0 <21.0.0" - } - }, - "node_modules/@types/github-script/node_modules/@types/node": { - "version": "20.17.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.5.tgz", - "integrity": "sha512-n8FYY/pRxu496441gIcAQFZPKXbhsd6VZygcq+PTSZ75eMh/Ke0hCAROdUa21qiFqKNsPPYic46yXDO1JGiPBQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~6.19.2" - } - }, - "node_modules/@types/github-script/node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -4253,13 +3892,6 @@ "tweetnacl": "^0.14.3" } }, - "node_modules/before-after-hook": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", - "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", - "dev": true, - "license": "Apache-2.0" - }, "node_modules/bluebird": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", @@ -4267,13 +3899,6 @@ "dev": true, "license": "MIT" }, - "node_modules/bottleneck": { - "version": "2.19.5", - "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", - "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", - "dev": true, - "license": "MIT" - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4891,13 +4516,6 @@ "node": ">=0.4.0" } }, - "node_modules/deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", - "dev": true, - "license": "ISC" - }, "node_modules/des.js": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", @@ -5966,10 +5584,6 @@ "assert-plus": "^1.0.0" } }, - "node_modules/github": { - "resolved": ".github", - "link": true - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -9566,19 +9180,6 @@ "dev": true, "license": "MIT" }, - "node_modules/undici": { - "version": "5.28.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", - "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, "node_modules/undici-types": { "version": "5.28.4", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.28.4.tgz", @@ -9599,13 +9200,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/universal-user-agent": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", - "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", - "dev": true, - "license": "ISC" - }, "node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", diff --git a/package.json b/package.json index 6d8cd5901380..722756e00be5 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "@typespec/streams": "0.62.0", "@typespec/versioning": "0.62.0", "azure-rest-api-specs-eng-tools": "file:eng/tools", - "github":"file:.github", "oav": "^3.5.1", "prettier": "~3.3.3", "typescript": "~5.6.2" From c5eee69fa291c40710994d5ca8f8752130b016fd Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 4 Nov 2024 22:12:40 +0000 Subject: [PATCH 31/73] Prevent warning in VS Code --- .../workflows/typespec-requirement-completed.yaml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index d265097b3fc3..dc9ca34e906e 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -30,6 +30,10 @@ jobs: runs-on: ubuntu-latest + env: + # May be set by get-keyvalue-artifacts. Setting to null here avoids warning in VS Code. + spec-lifecycle-resource-manager: + steps: - uses: actions/checkout@v4 with: @@ -48,13 +52,3 @@ jobs: - if: env.spec-lifecycle-resource-manager == 'brownfield' run: echo "brownfield" - # - if: ${{ fromJSON(steps.get-keyvalue-artifacts.outputs.result).spec-lifecycle-brownfield == 'true' }} - # name: Add label - # uses: actions/github-script@v7 - - # - name: Add label if artifact - # uses: actions/github-script@v7 - # with: - # script: | - # const typespecRequirementCompleted = require('./.github/scripts/typespec-requirement-completed.js') - # await typespecRequirementCompleted(github, context, core); From 4b7729f5df4bcab43470c981df385b6ca3c607a0 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 4 Nov 2024 22:16:50 +0000 Subject: [PATCH 32/73] Restore package-lock.json --- package-lock.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8817f8061a76..e88cda0d394e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "eng/tools": { "name": "azure-rest-api-specs-eng-tools", "dev": true, + "hasInstallScript": true, "devDependencies": { "@azure-tools/specs-model": "file:specs-model", "@azure-tools/suppressions": "file:suppressions", @@ -277,7 +278,6 @@ "eng/tools/specs-model": { "name": "@azure-tools/specs-model", "dev": true, - "hasInstallScript": true, "bin": { "get-specs-model": "cmd/get-specs-model.js" }, @@ -300,7 +300,6 @@ "eng/tools/suppressions": { "name": "@azure-tools/suppressions", "dev": true, - "hasInstallScript": true, "dependencies": { "minimatch": "^9.0.4", "yaml": "^2.4.2", @@ -323,7 +322,6 @@ "eng/tools/tsp-client-tests": { "name": "@azure-tools/tsp-client-tests", "dev": true, - "hasInstallScript": true, "devDependencies": { "@types/node": "^18.19.31", "execa": "^9.3.0", @@ -337,7 +335,6 @@ "eng/tools/typespec-requirement": { "name": "@azure-tools/typespec-requirement", "dev": true, - "hasInstallScript": true, "devDependencies": { "@types/node": "^18.19.31", "execa": "^9.3.0", @@ -351,7 +348,6 @@ "eng/tools/typespec-validation": { "name": "@azure-tools/typespec-validation", "dev": true, - "hasInstallScript": true, "dependencies": { "globby": "^14.0.1", "simple-git": "^3.24.0", From f93bfbb40b8ca9caa52d04aac8b5dc2bf73e6be1 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 4 Nov 2024 22:18:07 +0000 Subject: [PATCH 33/73] Improve comment --- .github/actions/get-keyvalue-artifacts/action.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index ba004ea5c12e..502ba7f889e2 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -42,7 +42,7 @@ module.exports = async ({ github, context, core }) => { const artifactNames = artifacts.data.artifacts.map((a) => a.name); for (const artifactName of artifactNames) { - // If artifactName has format `key=value`, add the key and value as env vars. + // If artifactName has format "key=value", add the key and value as env vars. // If artifactName does not contain "=", ignore. // If artifactName contains multiple "=", the key is everything before the first "=", // and the value is everything else. From bb5c325b39b841e4a64f596367d39edb0003a763 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 5 Nov 2024 23:04:36 +0000 Subject: [PATCH 34/73] Make workflow_dispatch parameters required --- .github/workflows/typespec-requirement-completed.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index dc9ca34e906e..2830b0c59e9c 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -5,19 +5,18 @@ on: workflows: ["TypeSpec Requirement"] types: [completed] workflow_dispatch: - # If any inputs are not set, we will attempt to extract them from the event context inputs: owner: description: The account owner of the repository. The name is not case sensitive. - required: false + required: true type: string repo: description: The name of the repository without the .git extension. The name is not case sensitive. - required: false + required: true type: string run_id: description: The unique identifier of the workflow run. - required: false + required: true type: number jobs: @@ -51,4 +50,3 @@ jobs: # TODO: Add label - if: env.spec-lifecycle-resource-manager == 'brownfield' run: echo "brownfield" - From b8376dd6b874b40d2e5ea08c37b7ce9a176e83ab Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 5 Nov 2024 23:07:48 +0000 Subject: [PATCH 35/73] Fix bug checking event action --- .github/actions/get-keyvalue-artifacts/action.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index 502ba7f889e2..b6be12bfc8ab 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -11,7 +11,7 @@ module.exports = async ({ github, context, core }) => { let run_id = parseInt(process.env.RUN_ID || ""); if (!owner && !repo && !run_id) { - if (context.eventName !== "workflow_run" || context.action == "completed") { + if (context.eventName !== "workflow_run" || context.action != "completed") { throw new Error( `Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`, ); From fb0363f81ee5f720e772155f0e823ce78e57947b Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 5 Nov 2024 23:07:56 +0000 Subject: [PATCH 36/73] Remove old comment --- .github/actions/get-keyvalue-artifacts/action.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/get-keyvalue-artifacts/action.yaml index 1ff38d83435d..4dbf59fefcfd 100644 --- a/.github/actions/get-keyvalue-artifacts/action.yaml +++ b/.github/actions/get-keyvalue-artifacts/action.yaml @@ -1,6 +1,5 @@ name: Get KeyValue Artifacts description: Sets env vars corresponding to keys and values encoded in artifact names -# description: Returns JSON object of keys and values encoded in artifact names # If any inputs are not set, we will attempt to extract them from the event context inputs: From cdd603d6d16bc28d39fe1372767fabe519eac912 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 5 Nov 2024 23:11:37 +0000 Subject: [PATCH 37/73] Only update vars not already set --- .github/actions/get-keyvalue-artifacts/action.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index b6be12bfc8ab..29f5945e98cd 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -10,7 +10,8 @@ module.exports = async ({ github, context, core }) => { let repo = process.env.REPO; let run_id = parseInt(process.env.RUN_ID || ""); - if (!owner && !repo && !run_id) { + if (!owner || !repo || !run_id) { + // TODO: Add support for more event types if (context.eventName !== "workflow_run" || context.action != "completed") { throw new Error( `Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`, @@ -22,13 +23,10 @@ module.exports = async ({ github, context, core }) => { context.payload ); - owner = payload.workflow_run.repository.owner.login; - repo = payload.workflow_run.repository.name; - run_id = payload.workflow_run.id; - } else if (!owner || !repo || !run_id) { - throw new Error( - "Parameters 'owner', 'repo', and 'run_id' must be all either set or unset", - ); + // Only update vars not already set + owner = owner || payload.workflow_run.repository.owner.login; + repo = repo || payload.workflow_run.repository.name; + run_id = run_id || payload.workflow_run.id; } const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ From fc11f44a4e32d42ff66675bc3f424dc1bf2e354e Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 5 Nov 2024 23:15:21 +0000 Subject: [PATCH 38/73] Fix context check --- .../actions/get-keyvalue-artifacts/action.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index 29f5945e98cd..ad06217c325e 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -11,22 +11,22 @@ module.exports = async ({ github, context, core }) => { let run_id = parseInt(process.env.RUN_ID || ""); if (!owner || !repo || !run_id) { - // TODO: Add support for more event types - if (context.eventName !== "workflow_run" || context.action != "completed") { + // TODO: Add support for more event types + if (context.eventName == "workflow_run" && context.action == "completed") { + const payload = + /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( + context.payload + ); + + // Only update vars not already set + owner = owner || payload.workflow_run.repository.owner.login; + repo = repo || payload.workflow_run.repository.name; + run_id = run_id || payload.workflow_run.id; + } else { throw new Error( `Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`, ); } - - const payload = - /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( - context.payload - ); - - // Only update vars not already set - owner = owner || payload.workflow_run.repository.owner.login; - repo = repo || payload.workflow_run.repository.name; - run_id = run_id || payload.workflow_run.id; } const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ From c5f43aef3f96c3d9160e35c109f5ce5401900345 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 5 Nov 2024 23:19:03 +0000 Subject: [PATCH 39/73] Use payload.action --- .github/actions/get-keyvalue-artifacts/action.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index ad06217c325e..df84b80318e7 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -12,7 +12,7 @@ module.exports = async ({ github, context, core }) => { if (!owner || !repo || !run_id) { // TODO: Add support for more event types - if (context.eventName == "workflow_run" && context.action == "completed") { + if (context.eventName == "workflow_run" && context.payload.action == "completed") { const payload = /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( context.payload @@ -24,7 +24,7 @@ module.exports = async ({ github, context, core }) => { run_id = run_id || payload.workflow_run.id; } else { throw new Error( - `Invalid context: '${context.eventName}:${context.action}'. Expected 'workflow_run:completed'.`, + `Invalid context: '${context.eventName}:${context.payload.action}'. Expected 'workflow_run:completed'.`, ); } } From 49d157376ea73af3f56758208d1e2105d1fc2e9e Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 06:28:25 +0000 Subject: [PATCH 40/73] Add action "set-label" --- .../actions/get-keyvalue-artifacts/action.js | 4 +- .github/actions/set-label/action.js | 78 +++++++++++++++++++ .github/actions/set-label/action.yaml | 42 ++++++++++ .../typespec-requirement-completed.yaml | 11 +-- 4 files changed, 128 insertions(+), 7 deletions(-) create mode 100644 .github/actions/set-label/action.js create mode 100644 .github/actions/set-label/action.yaml diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index df84b80318e7..9e067d3793ae 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -11,8 +11,8 @@ module.exports = async ({ github, context, core }) => { let run_id = parseInt(process.env.RUN_ID || ""); if (!owner || !repo || !run_id) { - // TODO: Add support for more event types - if (context.eventName == "workflow_run" && context.payload.action == "completed") { + // Add support for more event types as needed + if (context.eventName === "workflow_run" && context.payload.action === "completed") { const payload = /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( context.payload diff --git a/.github/actions/set-label/action.js b/.github/actions/set-label/action.js new file mode 100644 index 000000000000..3a2cf4f54d9e --- /dev/null +++ b/.github/actions/set-label/action.js @@ -0,0 +1,78 @@ +// @ts-check + +/** + * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments + */ +module.exports = async ({ github, context, core }) => { + console.log("context: " + JSON.stringify(context, null, 2)); + + let owner = process.env.OWNER; + let repo = process.env.REPO; + let issue_number = parseInt(process.env.ISSUE_NUMBER || ""); + + if (!owner || !repo || !issue_number) { + // Add support for more event types as needed + if ( + context.eventName === "workflow_run" && + context.payload.action === "completed" + ) { + const payload = + /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( + context.payload + ); + + // Only update vars not already set + owner = owner || payload.workflow_run.repository.owner.login; + repo = repo || payload.workflow_run.repository.name; + + if (!issue_number) { + let commit_sha = + process.env.COMMIT_SHA || payload.workflow_run.head_sha; + + // Must call this API, since 'payload.workflow_run.pull_requests' is empty for fork PRs + const { data: pullRequests } = + await github.rest.repos.listPullRequestsAssociatedWithCommit({ + owner: owner, + repo: repo, + commit_sha: commit_sha, + }); + + if (pullRequests.length === 1) { + issue_number = pullRequests[0].number; + } else { + throw new Error( + `Unexpected number of pull requests associated with commit '${commit_sha}'. Expected: '1'. Actual '${pullRequests.length}'.`, + ); + } + } + } else { + throw new Error( + `Invalid context: '${context.eventName}:${context.payload.action}'. Expected 'workflow_run:completed'.`, + ); + } + } + + let name = process.env.NAME; + if (!name) { + throw new Error(`Invalid name: '${name}'`); + } + + let value = process.env.VALUE; + if (value && value.toLowerCase() === "true") { + await github.rest.issues.addLabels({ + owner: owner, + repo: repo, + issue_number: issue_number, + labels: [name], + }); + } else if (value && value.toLowerCase() === "false") { + await github.rest.issues.removeLabel({ + owner: owner, + repo: repo, + issue_number: issue_number, + name: name, + }); + } else { + throw new Error(`Invalid value: '${value}'`); + } +}; diff --git a/.github/actions/set-label/action.yaml b/.github/actions/set-label/action.yaml new file mode 100644 index 000000000000..8246c23d8986 --- /dev/null +++ b/.github/actions/set-label/action.yaml @@ -0,0 +1,42 @@ +name: Set Label +description: Adds or removes label to set state matching value + +# If any inputs are not set, we will attempt to extract them from the event context +inputs: + name: + description: Name of the label + required: true + value: + description: Whether to add or remove the label + required: true + owner: + description: The account owner of the repository. The name is not case sensitive. + required: false + repo: + description: The name of the repository without the .git extension. The name is not case sensitive. + required: false + issue_number: + description: The number that identifies the issue. + required: false + commit_sha: + description: The SHA of the commit associated with the pull request. + required: false + + +runs: + using: composite + + steps: + - name: Set Label + uses: actions/github-script@v7 + env: + NAME: ${{ inputs.name }} + VALUE: ${{ inputs.value }} + OWNER: ${{ inputs.owner }} + REPO: ${{ inputs.repo }} + ISSUE_NUMBER: ${{ inputs.issue_number }} + COMMIT_SHA: ${{ inputs.commit_sha }} + with: + script: | + const action = require('./.github/actions/set-label/action.js') + await action({ github, context, core }); diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/typespec-requirement-completed.yaml index 2830b0c59e9c..c5d8c0076ba4 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/typespec-requirement-completed.yaml @@ -39,14 +39,15 @@ jobs: sparse-checkout: | .github - - id: get-keyvalue-artifacts - name: Get KeyValue artifacts + - name: Get KeyValue artifacts uses: ./.github/actions/get-keyvalue-artifacts with: owner: ${{ inputs.owner }} repo: ${{ inputs.repo }} run_id: ${{ inputs.run_id }} - # TODO: Add label - - if: env.spec-lifecycle-resource-manager == 'brownfield' - run: echo "brownfield" + - name: Set Label "brownfield" + uses: ./.github/actions/set-label + with: + name: brownfield + value: ${{ env.spec-lifecycle-resource-manager == 'brownfield' }} From 1b1b82b7caf5553034001166769f3cae94f361f9 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 06:51:41 +0000 Subject: [PATCH 41/73] Add LogNotice --- eng/common/scripts/logging.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/common/scripts/logging.ps1 b/eng/common/scripts/logging.ps1 index 1b459d004ad0..162e52a8216d 100644 --- a/eng/common/scripts/logging.ps1 +++ b/eng/common/scripts/logging.ps1 @@ -50,8 +50,7 @@ function LogSuccess { Write-Host "${green}$args${reset}" } -function LogErrorForFile($file, $errorString) -{ +function LogErrorForFile($file, $errorString) { if (Test-SupportsDevOpsLogging) { Write-Host ("##vso[task.logissue type=error;sourcepath=$file;linenumber=1;columnnumber=1;]$errorString" -replace "`n", "%0D%0A") } From 8ba1b21d0eae13f8a5f09b4c5957fa831fa614b6 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 16:52:15 +0000 Subject: [PATCH 42/73] Remove extra whitespace --- .github/actions/set-label/action.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/set-label/action.yaml b/.github/actions/set-label/action.yaml index 8246c23d8986..9692b0acaca5 100644 --- a/.github/actions/set-label/action.yaml +++ b/.github/actions/set-label/action.yaml @@ -21,7 +21,6 @@ inputs: commit_sha: description: The SHA of the commit associated with the pull request. required: false - runs: using: composite From 3677ba96ea1933eeb4e1fc75745ed2dbcf69b84a Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 16:52:36 +0000 Subject: [PATCH 43/73] Extract owner and repo from head_repository --- .github/actions/set-label/action.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/set-label/action.js b/.github/actions/set-label/action.js index 3a2cf4f54d9e..9463d2e9d508 100644 --- a/.github/actions/set-label/action.js +++ b/.github/actions/set-label/action.js @@ -22,8 +22,8 @@ module.exports = async ({ github, context, core }) => { ); // Only update vars not already set - owner = owner || payload.workflow_run.repository.owner.login; - repo = repo || payload.workflow_run.repository.name; + owner = owner || payload.workflow_run.head_repository.owner.login; + repo = repo || payload.workflow_run.head_repository.name; if (!issue_number) { let commit_sha = From 7ce0d1b488412537b41befe0119fe43e34610d2d Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 17:01:02 +0000 Subject: [PATCH 44/73] Use target owner and repo to set label --- .github/actions/set-label/action.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/actions/set-label/action.js b/.github/actions/set-label/action.js index 9463d2e9d508..2090c286d256 100644 --- a/.github/actions/set-label/action.js +++ b/.github/actions/set-label/action.js @@ -22,8 +22,14 @@ module.exports = async ({ github, context, core }) => { ); // Only update vars not already set - owner = owner || payload.workflow_run.head_repository.owner.login; - repo = repo || payload.workflow_run.head_repository.name; + + // Owner and repo for the PR target + owner = owner || payload.workflow_run.repository.owner.login; + repo = repo || payload.workflow_run.repository.name; + + // Owner and repo for the PR head (may be different than target for fork PRs) + const head_owner = payload.workflow_run.head_repository.owner.login; + const head_repo = payload.workflow_run.head_repository.name; if (!issue_number) { let commit_sha = @@ -32,8 +38,8 @@ module.exports = async ({ github, context, core }) => { // Must call this API, since 'payload.workflow_run.pull_requests' is empty for fork PRs const { data: pullRequests } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ - owner: owner, - repo: repo, + owner: head_owner, + repo: head_repo, commit_sha: commit_sha, }); From 80704da6c63053b56829b4b02a452dbd209d775f Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 17:01:28 +0000 Subject: [PATCH 45/73] Improve comment --- .github/actions/set-label/action.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/set-label/action.js b/.github/actions/set-label/action.js index 2090c286d256..2bb70f190536 100644 --- a/.github/actions/set-label/action.js +++ b/.github/actions/set-label/action.js @@ -27,7 +27,7 @@ module.exports = async ({ github, context, core }) => { owner = owner || payload.workflow_run.repository.owner.login; repo = repo || payload.workflow_run.repository.name; - // Owner and repo for the PR head (may be different than target for fork PRs) + // Owner and repo for the PR head (may differ from target for fork PRs) const head_owner = payload.workflow_run.head_repository.owner.login; const head_repo = payload.workflow_run.head_repository.name; From 7b15c4e59a22661cb8102123d029a3b62d9145f7 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 17:47:06 +0000 Subject: [PATCH 46/73] Shared function to extract inputs from context --- .github/actions/context.js | 62 +++++++++++++++++++ .../actions/get-keyvalue-artifacts/action.js | 2 + .github/actions/set-label/action.js | 53 +++------------- 3 files changed, 71 insertions(+), 46 deletions(-) create mode 100644 .github/actions/context.js diff --git a/.github/actions/context.js b/.github/actions/context.js new file mode 100644 index 000000000000..2e26e836ef49 --- /dev/null +++ b/.github/actions/context.js @@ -0,0 +1,62 @@ +// @ts-check +/** + * @param {import('github-script').AsyncFunctionArguments['github']} github + * @param {import('github-script').AsyncFunctionArguments['context']} context + * @returns {Promise<{owner: string, repo: string, issue_number: number}>} + */ +async function extractInputs(github, context) { + // Add support for more event types as needed + if ( + context.eventName === "workflow_run" && + context.payload.action === "completed" + ) { + const payload = + /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( + context.payload + ); + + // Owner and repo for the PR target + const owner = payload.workflow_run.repository.owner.login; + const repo = payload.workflow_run.repository.name; + let issue_number; + + const pull_requests = payload.workflow_run.pull_requests; + if (pull_requests && pull_requests.length > 0) { + // For non-fork PRs, we should be able to extract the PR number from the payload, which avoids an + // unnecessary API call. The listPullRequestsAssociatedWithCommit() API also seems to return + // empty for non-fork PRs. + issue_number = pull_requests[0].number; + } else { + // For fork PRs, we must call an API in the head repository to get the PR number in the target repository + + // Owner and repo for the PR head (may differ from target for fork PRs) + const head_owner = payload.workflow_run.head_repository.owner.login; + const head_repo = payload.workflow_run.head_repository.name; + + let commit_sha = process.env.COMMIT_SHA || payload.workflow_run.head_sha; + + const { data: pullRequests } = + await github.rest.repos.listPullRequestsAssociatedWithCommit({ + owner: head_owner, + repo: head_repo, + commit_sha: commit_sha, + }); + + if (pullRequests.length === 1) { + issue_number = pullRequests[0].number; + } else { + throw new Error( + `Unexpected number of pull requests associated with commit '${commit_sha}'. Expected: '1'. Actual '${pullRequests.length}'.`, + ); + } + } + + return { owner: owner, repo: repo, issue_number: issue_number }; + } else { + throw new Error( + `Invalid context: '${context.eventName}:${context.payload.action}'. Expected 'workflow_run:completed'.`, + ); + } +} + +module.exports = { extractInputs }; diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index 9e067d3793ae..b58b52e73073 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -11,6 +11,8 @@ module.exports = async ({ github, context, core }) => { let run_id = parseInt(process.env.RUN_ID || ""); if (!owner || !repo || !run_id) { + // TODO: Replace with call to context.extractInputs() + // Add support for more event types as needed if (context.eventName === "workflow_run" && context.payload.action === "completed") { const payload = diff --git a/.github/actions/set-label/action.js b/.github/actions/set-label/action.js index 2bb70f190536..ab33de66604f 100644 --- a/.github/actions/set-label/action.js +++ b/.github/actions/set-label/action.js @@ -1,9 +1,11 @@ // @ts-check +const { extractInputs } = require('../context'); + /** * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ -module.exports = async ({ github, context, core }) => { +module.exports = async ({ github, context }) => { console.log("context: " + JSON.stringify(context, null, 2)); let owner = process.env.OWNER; @@ -11,51 +13,10 @@ module.exports = async ({ github, context, core }) => { let issue_number = parseInt(process.env.ISSUE_NUMBER || ""); if (!owner || !repo || !issue_number) { - // Add support for more event types as needed - if ( - context.eventName === "workflow_run" && - context.payload.action === "completed" - ) { - const payload = - /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( - context.payload - ); - - // Only update vars not already set - - // Owner and repo for the PR target - owner = owner || payload.workflow_run.repository.owner.login; - repo = repo || payload.workflow_run.repository.name; - - // Owner and repo for the PR head (may differ from target for fork PRs) - const head_owner = payload.workflow_run.head_repository.owner.login; - const head_repo = payload.workflow_run.head_repository.name; - - if (!issue_number) { - let commit_sha = - process.env.COMMIT_SHA || payload.workflow_run.head_sha; - - // Must call this API, since 'payload.workflow_run.pull_requests' is empty for fork PRs - const { data: pullRequests } = - await github.rest.repos.listPullRequestsAssociatedWithCommit({ - owner: head_owner, - repo: head_repo, - commit_sha: commit_sha, - }); - - if (pullRequests.length === 1) { - issue_number = pullRequests[0].number; - } else { - throw new Error( - `Unexpected number of pull requests associated with commit '${commit_sha}'. Expected: '1'. Actual '${pullRequests.length}'.`, - ); - } - } - } else { - throw new Error( - `Invalid context: '${context.eventName}:${context.payload.action}'. Expected 'workflow_run:completed'.`, - ); - } + let inputsFromContext = await extractInputs(github, context); + owner = owner || inputsFromContext.owner; + repo = repo || inputsFromContext.repo; + issue_number = issue_number || inputsFromContext.issue_number; } let name = process.env.NAME; From 881ab9982fd31bb27ffb7caabf6d81ad0cd027b4 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 17:58:42 +0000 Subject: [PATCH 47/73] Ignore errors removing label --- .github/actions/set-label/action.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/actions/set-label/action.js b/.github/actions/set-label/action.js index ab33de66604f..5a26202e06e3 100644 --- a/.github/actions/set-label/action.js +++ b/.github/actions/set-label/action.js @@ -5,7 +5,7 @@ const { extractInputs } = require('../context'); /** * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ -module.exports = async ({ github, context }) => { +module.exports = async ({ github, context, core }) => { console.log("context: " + JSON.stringify(context, null, 2)); let owner = process.env.OWNER; @@ -33,12 +33,22 @@ module.exports = async ({ github, context }) => { labels: [name], }); } else if (value && value.toLowerCase() === "false") { - await github.rest.issues.removeLabel({ - owner: owner, - repo: repo, - issue_number: issue_number, - name: name, - }); + try { + await github.rest.issues.removeLabel({ + owner: owner, + repo: repo, + issue_number: issue_number, + name: name, + }); + } + catch (error) { + if (error.status === 404) { + core.info(`Ignoring error: ${error.status} - ${error.message}`); + } + else { + throw error; + } + } } else { throw new Error(`Invalid value: '${value}'`); } From ac866433f16056a9a5a7bc4b563621c5b768c960 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 17:59:21 +0000 Subject: [PATCH 48/73] Remove context logging --- .github/actions/get-keyvalue-artifacts/action.js | 2 -- .github/actions/set-label/action.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index b58b52e73073..a1e9caac2671 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -4,8 +4,6 @@ * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ module.exports = async ({ github, context, core }) => { - console.log("context: " + JSON.stringify(context, null, 2)); - let owner = process.env.OWNER; let repo = process.env.REPO; let run_id = parseInt(process.env.RUN_ID || ""); diff --git a/.github/actions/set-label/action.js b/.github/actions/set-label/action.js index 5a26202e06e3..9d2007cbac50 100644 --- a/.github/actions/set-label/action.js +++ b/.github/actions/set-label/action.js @@ -6,8 +6,6 @@ const { extractInputs } = require('../context'); * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ module.exports = async ({ github, context, core }) => { - console.log("context: " + JSON.stringify(context, null, 2)); - let owner = process.env.OWNER; let repo = process.env.REPO; let issue_number = parseInt(process.env.ISSUE_NUMBER || ""); From 9efc5cb090989217e4e0999dd3894f8b46dd4806 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 18:05:01 +0000 Subject: [PATCH 49/73] Add run_id to inputs --- .github/actions/context.js | 15 ++++++----- .../actions/get-keyvalue-artifacts/action.js | 26 +++++-------------- .github/actions/set-label/action.js | 2 +- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/.github/actions/context.js b/.github/actions/context.js index 2e26e836ef49..54933e8729fc 100644 --- a/.github/actions/context.js +++ b/.github/actions/context.js @@ -2,9 +2,10 @@ /** * @param {import('github-script').AsyncFunctionArguments['github']} github * @param {import('github-script').AsyncFunctionArguments['context']} context - * @returns {Promise<{owner: string, repo: string, issue_number: number}>} + * @param {import('github-script').AsyncFunctionArguments['core']} core + * @returns {Promise<{owner: string, repo: string, issue_number: number, run_id: number }>} */ -async function extractInputs(github, context) { +async function extractInputs(github, context, core) { // Add support for more event types as needed if ( context.eventName === "workflow_run" && @@ -15,9 +16,6 @@ async function extractInputs(github, context) { context.payload ); - // Owner and repo for the PR target - const owner = payload.workflow_run.repository.owner.login; - const repo = payload.workflow_run.repository.name; let issue_number; const pull_requests = payload.workflow_run.pull_requests; @@ -51,7 +49,12 @@ async function extractInputs(github, context) { } } - return { owner: owner, repo: repo, issue_number: issue_number }; + return { + owner: payload.workflow_run.repository.owner.login, + repo: payload.workflow_run.repository.name, + issue_number: issue_number, + run_id: payload.workflow_run.id, + }; } else { throw new Error( `Invalid context: '${context.eventName}:${context.payload.action}'. Expected 'workflow_run:completed'.`, diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index a1e9caac2671..8e705f2c848b 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -1,5 +1,7 @@ // @ts-check +const { extractInputs } = require('../context'); + /** * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ @@ -9,24 +11,10 @@ module.exports = async ({ github, context, core }) => { let run_id = parseInt(process.env.RUN_ID || ""); if (!owner || !repo || !run_id) { - // TODO: Replace with call to context.extractInputs() - - // Add support for more event types as needed - if (context.eventName === "workflow_run" && context.payload.action === "completed") { - const payload = - /** @type {import("@octokit/webhooks-types").WorkflowRunCompletedEvent} */ ( - context.payload - ); - - // Only update vars not already set - owner = owner || payload.workflow_run.repository.owner.login; - repo = repo || payload.workflow_run.repository.name; - run_id = run_id || payload.workflow_run.id; - } else { - throw new Error( - `Invalid context: '${context.eventName}:${context.payload.action}'. Expected 'workflow_run:completed'.`, - ); - } + let inputsFromContext = await extractInputs(github, context, core); + owner = owner || inputsFromContext.owner; + repo = repo || inputsFromContext.repo; + run_id = run_id || inputsFromContext.run_id; } const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ @@ -35,8 +23,6 @@ module.exports = async ({ github, context, core }) => { run_id: run_id, }); - console.log("artifacts: " + JSON.stringify(artifacts, null, 2)); - const artifactNames = artifacts.data.artifacts.map((a) => a.name); for (const artifactName of artifactNames) { diff --git a/.github/actions/set-label/action.js b/.github/actions/set-label/action.js index 9d2007cbac50..9b0c0f52e5f1 100644 --- a/.github/actions/set-label/action.js +++ b/.github/actions/set-label/action.js @@ -11,7 +11,7 @@ module.exports = async ({ github, context, core }) => { let issue_number = parseInt(process.env.ISSUE_NUMBER || ""); if (!owner || !repo || !issue_number) { - let inputsFromContext = await extractInputs(github, context); + let inputsFromContext = await extractInputs(github, context, core); owner = owner || inputsFromContext.owner; repo = repo || inputsFromContext.repo; issue_number = issue_number || inputsFromContext.issue_number; From df03c45ab94bc9489b06e783918e278a528282f9 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 18:14:26 +0000 Subject: [PATCH 50/73] Restore package-lock.json --- package-lock.json | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index e88cda0d394e..97b673994411 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1980,11 +1980,20 @@ "dev": true, "license": "MIT" }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", - "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", - "deprecated": "Use @eslint/config-array instead", + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", "dev": true, "license": "Apache-2.0", "dependencies": { From 6aacb70378112e6d68030fb5e27ee54dae9bb708 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 13 Nov 2024 18:14:34 +0000 Subject: [PATCH 51/73] Cleanup --- .github/actions/context.js | 1 + .github/actions/get-keyvalue-artifacts/action.yaml | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/actions/context.js b/.github/actions/context.js index 54933e8729fc..e39a6ac12821 100644 --- a/.github/actions/context.js +++ b/.github/actions/context.js @@ -1,4 +1,5 @@ // @ts-check + /** * @param {import('github-script').AsyncFunctionArguments['github']} github * @param {import('github-script').AsyncFunctionArguments['context']} context diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/get-keyvalue-artifacts/action.yaml index 4dbf59fefcfd..c61580362d69 100644 --- a/.github/actions/get-keyvalue-artifacts/action.yaml +++ b/.github/actions/get-keyvalue-artifacts/action.yaml @@ -27,7 +27,3 @@ runs: script: | const action = require('./.github/actions/get-keyvalue-artifacts/action.js') await action({ github, context, core }); - - # TODO: Remove before merge - - run: printenv - shell: bash From 8cb91e53accf1d9e554afd19d61219d4a529b96d Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Thu, 14 Nov 2024 02:48:38 +0000 Subject: [PATCH 52/73] Add logging --- .github/actions/context.js | 9 ++++++++- .github/actions/get-keyvalue-artifacts/action.js | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/actions/context.js b/.github/actions/context.js index e39a6ac12821..5d366b9d73c8 100644 --- a/.github/actions/context.js +++ b/.github/actions/context.js @@ -7,6 +7,8 @@ * @returns {Promise<{owner: string, repo: string, issue_number: number, run_id: number }>} */ async function extractInputs(github, context, core) { + core.info(`extractInputs(${context.eventName}, ${context.payload.action})`) + // Add support for more event types as needed if ( context.eventName === "workflow_run" && @@ -34,6 +36,7 @@ async function extractInputs(github, context, core) { let commit_sha = process.env.COMMIT_SHA || payload.workflow_run.head_sha; + core.info(`listPullRequestsAssociatedWithCommit(${head_owner}, ${head_repo}, ${commit_sha})`); const { data: pullRequests } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ owner: head_owner, @@ -50,12 +53,16 @@ async function extractInputs(github, context, core) { } } - return { + const inputs = { owner: payload.workflow_run.repository.owner.login, repo: payload.workflow_run.repository.name, issue_number: issue_number, run_id: payload.workflow_run.id, }; + + core.info(`inputs: ${JSON.stringify(inputs)}`); + + return inputs; } else { throw new Error( `Invalid context: '${context.eventName}:${context.payload.action}'. Expected 'workflow_run:completed'.`, diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index 8e705f2c848b..b6b4b85bdb64 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -17,6 +17,7 @@ module.exports = async ({ github, context, core }) => { run_id = run_id || inputsFromContext.run_id; } + core.info(`listWorkflowRunArtifacts(${owner}, ${repo}, ${run_id})`); const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: owner, repo: repo, @@ -24,6 +25,7 @@ module.exports = async ({ github, context, core }) => { }); const artifactNames = artifacts.data.artifacts.map((a) => a.name); + core.info(`artifactNames: ${JSON.stringify(artifactNames)}`) for (const artifactName of artifactNames) { // If artifactName has format "key=value", add the key and value as env vars. @@ -34,6 +36,7 @@ module.exports = async ({ github, context, core }) => { if (firstEquals !== -1) { const key = artifactName.substring(0, firstEquals); const value = artifactName.substring(firstEquals + 1); + core.info(`exportVariable(${key}, ${value})`); core.exportVariable(key, value); } } From 32d230c8169a6cf22ba7ad8fc53d3482c0426988 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 01:42:21 +0000 Subject: [PATCH 53/73] Support "pull_request" event type --- .github/actions/context.js | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/actions/context.js b/.github/actions/context.js index 5d366b9d73c8..020a4a86089d 100644 --- a/.github/actions/context.js +++ b/.github/actions/context.js @@ -7,10 +7,26 @@ * @returns {Promise<{owner: string, repo: string, issue_number: number, run_id: number }>} */ async function extractInputs(github, context, core) { - core.info(`extractInputs(${context.eventName}, ${context.payload.action})`) + core.info(`extractInputs(${context.eventName}, ${context.payload.action})`); // Add support for more event types as needed - if ( + if (context.eventName === "pull_request") { + const payload = + /** @type {import("@octokit/webhooks-types").PullRequestEvent} */ ( + context.payload + ); + + const inputs = { + owner: payload.repository.owner.login, + repo: payload.repository.name, + issue_number: payload.number, + run_id: NaN + }; + + core.info(`inputs: ${JSON.stringify(inputs)}`); + + return inputs; + } else if ( context.eventName === "workflow_run" && context.payload.action === "completed" ) { @@ -33,22 +49,23 @@ async function extractInputs(github, context, core) { // Owner and repo for the PR head (may differ from target for fork PRs) const head_owner = payload.workflow_run.head_repository.owner.login; const head_repo = payload.workflow_run.head_repository.name; + const head_sha = payload.workflow_run.head_sha; - let commit_sha = process.env.COMMIT_SHA || payload.workflow_run.head_sha; - - core.info(`listPullRequestsAssociatedWithCommit(${head_owner}, ${head_repo}, ${commit_sha})`); + core.info( + `listPullRequestsAssociatedWithCommit(${head_owner}, ${head_repo}, ${head_sha})`, + ); const { data: pullRequests } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ owner: head_owner, repo: head_repo, - commit_sha: commit_sha, + commit_sha: head_sha, }); if (pullRequests.length === 1) { issue_number = pullRequests[0].number; } else { throw new Error( - `Unexpected number of pull requests associated with commit '${commit_sha}'. Expected: '1'. Actual '${pullRequests.length}'.`, + `Unexpected number of pull requests associated with commit '${head_sha}'. Expected: '1'. Actual '${pullRequests.length}'.`, ); } } From 623d011dd4af82e677e5541c8518856fab38ae9d Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 01:43:09 +0000 Subject: [PATCH 54/73] Remove commit_sha input --- .github/actions/set-label/action.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/actions/set-label/action.yaml b/.github/actions/set-label/action.yaml index 9692b0acaca5..cd405626f533 100644 --- a/.github/actions/set-label/action.yaml +++ b/.github/actions/set-label/action.yaml @@ -18,9 +18,6 @@ inputs: issue_number: description: The number that identifies the issue. required: false - commit_sha: - description: The SHA of the commit associated with the pull request. - required: false runs: using: composite @@ -34,7 +31,6 @@ runs: OWNER: ${{ inputs.owner }} REPO: ${{ inputs.repo }} ISSUE_NUMBER: ${{ inputs.issue_number }} - COMMIT_SHA: ${{ inputs.commit_sha }} with: script: | const action = require('./.github/actions/set-label/action.js') From 79f0d2fe2f05016890671d14357495da6eebeef7 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 01:43:42 +0000 Subject: [PATCH 55/73] Rename workflow to "Update Labels" and run on label triggers --- ...ement-completed.yaml => update-labels.yaml} | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) rename .github/workflows/{typespec-requirement-completed.yaml => update-labels.yaml} (66%) diff --git a/.github/workflows/typespec-requirement-completed.yaml b/.github/workflows/update-labels.yaml similarity index 66% rename from .github/workflows/typespec-requirement-completed.yaml rename to .github/workflows/update-labels.yaml index c5d8c0076ba4..905c89528579 100644 --- a/.github/workflows/typespec-requirement-completed.yaml +++ b/.github/workflows/update-labels.yaml @@ -1,6 +1,10 @@ -name: TypeSpec Requirement - Completed +name: Update Labels on: + # If a pull request is manually labeled or unlabeled, get all artifacts associated with PR, and update labels + pull_request: + types: [labeled, unlabeled] + # If an upstream workflow if completed, get only the artifacts from that workflow, and update labels workflow_run: workflows: ["TypeSpec Requirement"] types: [completed] @@ -14,9 +18,15 @@ on: description: The name of the repository without the .git extension. The name is not case sensitive. required: true type: string + # simulate pull_request trigger + issue_number: + description: The number that identifies the issue. + required: false + type: number + # simulate workflow_run trigger run_id: description: The unique identifier of the workflow run. - required: true + required: false type: number jobs: @@ -44,6 +54,7 @@ jobs: with: owner: ${{ inputs.owner }} repo: ${{ inputs.repo }} + issue_number: ${{ inputs.issue_number }} run_id: ${{ inputs.run_id }} - name: Set Label "brownfield" @@ -51,3 +62,6 @@ jobs: with: name: brownfield value: ${{ env.spec-lifecycle-resource-manager == 'brownfield' }} + owner: ${{ inputs.owner }} + repo: ${{ inputs.repo }} + issue_number: ${{ inputs.issue_number }} From da8e5eec5c346403eec488e66d8e4a0650411e2b Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 01:45:47 +0000 Subject: [PATCH 56/73] WIP: Add support for getting artifacts from an issue_number --- .../actions/get-keyvalue-artifacts/action.js | 29 +++++++++++++------ .../get-keyvalue-artifacts/action.yaml | 4 +++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js index b6b4b85bdb64..3b34bb9df2be 100644 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ b/.github/actions/get-keyvalue-artifacts/action.js @@ -8,25 +8,36 @@ const { extractInputs } = require('../context'); module.exports = async ({ github, context, core }) => { let owner = process.env.OWNER; let repo = process.env.REPO; + let issue_number = parseInt(process.env.ISSUE_NUMBER || ""); let run_id = parseInt(process.env.RUN_ID || ""); - if (!owner || !repo || !run_id) { + if (!owner || !repo || !(issue_number || run_id)) { let inputsFromContext = await extractInputs(github, context, core); owner = owner || inputsFromContext.owner; repo = repo || inputsFromContext.repo; + issue_number = issue_number || inputsFromContext.issue_number; run_id = run_id || inputsFromContext.run_id; } - core.info(`listWorkflowRunArtifacts(${owner}, ${repo}, ${run_id})`); - const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: owner, - repo: repo, - run_id: run_id, - }); + /** @type {string[]} */ + let artifactNames = []; - const artifactNames = artifacts.data.artifacts.map((a) => a.name); - core.info(`artifactNames: ${JSON.stringify(artifactNames)}`) + if (run_id) { + // List artifacts from a single run_id + core.info(`listWorkflowRunArtifacts(${owner}, ${repo}, ${run_id})`); + const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: owner, + repo: repo, + run_id: run_id, + }); + + artifactNames = artifacts.data.artifacts.map((a) => a.name); + } + else { + // TODO: List all artifacts of issue_number + } + core.info(`artifactNames: ${JSON.stringify(artifactNames)}`) for (const artifactName of artifactNames) { // If artifactName has format "key=value", add the key and value as env vars. // If artifactName does not contain "=", ignore. diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/get-keyvalue-artifacts/action.yaml index c61580362d69..5bdaa1e14e6a 100644 --- a/.github/actions/get-keyvalue-artifacts/action.yaml +++ b/.github/actions/get-keyvalue-artifacts/action.yaml @@ -12,6 +12,9 @@ inputs: run_id: description: The unique identifier of the workflow run. required: false + issue_number: + description: The number that identifies the issue. + required: false runs: using: composite @@ -23,6 +26,7 @@ runs: OWNER: ${{ inputs.owner }} REPO: ${{ inputs.repo }} RUN_ID: ${{ inputs.run_id }} + ISSUE_NUMBER: ${{ inputs.issue_number }} with: script: | const action = require('./.github/actions/get-keyvalue-artifacts/action.js') From 7defa4b42f5095a6f9348447bcde681b723a9e5b Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 03:11:21 +0000 Subject: [PATCH 57/73] Rename to add-label-artifact --- .../action.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename .github/actions/{upload-keyvalue-artifact => add-label-artifact}/action.yaml (78%) diff --git a/.github/actions/upload-keyvalue-artifact/action.yaml b/.github/actions/add-label-artifact/action.yaml similarity index 78% rename from .github/actions/upload-keyvalue-artifact/action.yaml rename to .github/actions/add-label-artifact/action.yaml index eaf0d04162cb..1600265f47be 100644 --- a/.github/actions/upload-keyvalue-artifact/action.yaml +++ b/.github/actions/add-label-artifact/action.yaml @@ -1,12 +1,12 @@ -name: Upload KeyValue Artifact -description: Uploads an empty artifact with the specified key and value encoded in the name +name: Add Label Artifact +description: Uploads an empty artifact named `label-${name}=${value}` inputs: - key: - description: Key + name: + description: Name required: true value: - description: Value + description: Value ("true" or "false") required: true runs: @@ -25,7 +25,7 @@ runs: # https://github.com/actions/toolkit/blob/main/packages/artifact/src/internal/upload/path-and-artifact-name-validation.ts - uses: actions/upload-artifact@v4 with: - name: ${{ inputs.key }}=${{ inputs.value }} + name: label-${{ inputs.name }}=${{ inputs.value }} path: ${{ runner.temp }}/empty.txt if-no-files-found: error overwrite: true From 34fb0be2c9a3b628395dc756c22fa16cb0e6f74d Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 03:12:29 +0000 Subject: [PATCH 58/73] Fix job name --- .github/workflows/update-labels.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-labels.yaml b/.github/workflows/update-labels.yaml index 905c89528579..e313df4c813a 100644 --- a/.github/workflows/update-labels.yaml +++ b/.github/workflows/update-labels.yaml @@ -30,8 +30,8 @@ on: type: number jobs: - typespec-requirement-completed: - name: TypeSpec Requirement - Completed + update-labels: + name: Update Labels permissions: contents: read From 0eacd2c8342c61cad4778613859eb7a12e8f7627 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 03:13:35 +0000 Subject: [PATCH 59/73] Remove matrix from TypeSpec Requirement - Both data-plane and resource-manager are now required --- .github/workflows/typespec-requirement.yaml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index 4aa37c4079bb..9825c18058e9 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -5,10 +5,6 @@ on: pull_request jobs: TypeSpec-Requirement: name: TypeSpec Requirement - strategy: - fail-fast: false - matrix: - spec-type: [data-plane, resource-manager] runs-on: ubuntu-latest @@ -27,14 +23,12 @@ jobs: eng/scripts/TypeSpec-Requirement.ps1 ` -BaseCommitish HEAD^ ` -TargetCommitish HEAD ` - -SpecType ${{ matrix.spec-type }} id: tsr-ps1 shell: pwsh - - if: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} - uses: ./.github/actions/upload-keyvalue-artifact + - uses: ./.github/actions/add-label-artifact name: Upload artifact with results with: - key: spec-lifecycle-${{ matrix.spec-type }} - value: ${{ steps.tsr-ps1.outputs.spec-lifecycle }} + key: "brownfield" + value: "${{ steps.tsr-ps1.outputs.spec-lifecycle == 'brownfield' }}" From b6e7b87e479798e99a46bb595da0d9faf9cfdb2e Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 03:15:23 +0000 Subject: [PATCH 60/73] Fix input name --- .github/workflows/typespec-requirement.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index 9825c18058e9..a5f506e3f0ec 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -29,6 +29,6 @@ jobs: - uses: ./.github/actions/add-label-artifact name: Upload artifact with results with: - key: "brownfield" + name: "brownfield" value: "${{ steps.tsr-ps1.outputs.spec-lifecycle == 'brownfield' }}" From ba82cdbe26fdf7053c046af390e0de101a9ceafd Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 03:30:08 +0000 Subject: [PATCH 61/73] Simplify output --- .github/workflows/typespec-requirement.yaml | 5 ++--- eng/scripts/TypeSpec-Requirement.ps1 | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/typespec-requirement.yaml b/.github/workflows/typespec-requirement.yaml index a5f506e3f0ec..47909f268cfd 100644 --- a/.github/workflows/typespec-requirement.yaml +++ b/.github/workflows/typespec-requirement.yaml @@ -17,8 +17,6 @@ jobs: - name: Setup Node and run `npm ci` uses: ./.github/actions/setup-node-npm-ci - # Outputs - # - spec-lifecycle?: "brownfield" - run: | eng/scripts/TypeSpec-Requirement.ps1 ` -BaseCommitish HEAD^ ` @@ -26,9 +24,10 @@ jobs: id: tsr-ps1 shell: pwsh + # Always add label artifact, even if "brownfield=false", to ensure label is removed when necessary - uses: ./.github/actions/add-label-artifact name: Upload artifact with results with: name: "brownfield" - value: "${{ steps.tsr-ps1.outputs.spec-lifecycle == 'brownfield' }}" + value: "${{ steps.tsr-ps1.outputs.brownfield == 'true' }}" diff --git a/eng/scripts/TypeSpec-Requirement.ps1 b/eng/scripts/TypeSpec-Requirement.ps1 index dfb9d1084ae7..6e0e0eb74971 100644 --- a/eng/scripts/TypeSpec-Requirement.ps1 +++ b/eng/scripts/TypeSpec-Requirement.ps1 @@ -174,7 +174,7 @@ else { if ($env:GITHUB_OUTPUT) { # Set output to be used later in /.github/workflows/TypeSpec-Requirement.yaml - Add-Content -Path $env:GITHUB_OUTPUT -Value "spec-lifecycle=brownfield" + Add-Content -Path $env:GITHUB_OUTPUT -Value "brownfield=true" } } elseif ($responseStatus -eq 404) { From 2585c0a8b8dc1f964cffae7aa65d8bafeceb8169 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 03:30:26 +0000 Subject: [PATCH 62/73] [set-label] Default value to "true" --- .github/actions/set-label/action.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/set-label/action.yaml b/.github/actions/set-label/action.yaml index cd405626f533..dc05d9658268 100644 --- a/.github/actions/set-label/action.yaml +++ b/.github/actions/set-label/action.yaml @@ -7,8 +7,9 @@ inputs: description: Name of the label required: true value: - description: Whether to add or remove the label - required: true + description: Whether to add or remove the label ("true" or "false") + required: false + default: "true" owner: description: The account owner of the repository. The name is not case sensitive. required: false From bba99f64295d3a2c40a1be9d621100e15f2327d4 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 08:44:45 +0000 Subject: [PATCH 63/73] Refactor to create update-labels composite action --- .../actions/add-label-artifact/action.yaml | 4 +- .../actions/get-keyvalue-artifacts/action.js | 54 ---------- .github/actions/set-label/action.js | 53 --------- .github/actions/set-label/action.yaml | 38 ------- .github/actions/update-labels/action.js | 102 ++++++++++++++++++ .../action.yaml | 18 ++-- .github/workflows/update-labels.yaml | 17 +-- 7 files changed, 114 insertions(+), 172 deletions(-) delete mode 100644 .github/actions/get-keyvalue-artifacts/action.js delete mode 100644 .github/actions/set-label/action.js delete mode 100644 .github/actions/set-label/action.yaml create mode 100644 .github/actions/update-labels/action.js rename .github/actions/{get-keyvalue-artifacts => update-labels}/action.yaml (67%) diff --git a/.github/actions/add-label-artifact/action.yaml b/.github/actions/add-label-artifact/action.yaml index 1600265f47be..72ecdec81ef9 100644 --- a/.github/actions/add-label-artifact/action.yaml +++ b/.github/actions/add-label-artifact/action.yaml @@ -1,5 +1,5 @@ name: Add Label Artifact -description: Uploads an empty artifact named `label-${name}=${value}` +description: Uploads an empty artifact named `label-${name}=${value}`, that's consumed by update-labels.yaml inputs: name: @@ -13,8 +13,6 @@ runs: using: composite steps: - # When possible, it's best to upload an empty file with all information in the artifact name, so consumers - # can query the information without needing to download files to disk. - name: Create empty file to upload artifact run: "> $RUNNER_TEMP/empty.txt" shell: bash diff --git a/.github/actions/get-keyvalue-artifacts/action.js b/.github/actions/get-keyvalue-artifacts/action.js deleted file mode 100644 index 3b34bb9df2be..000000000000 --- a/.github/actions/get-keyvalue-artifacts/action.js +++ /dev/null @@ -1,54 +0,0 @@ -// @ts-check - -const { extractInputs } = require('../context'); - -/** - * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments - */ -module.exports = async ({ github, context, core }) => { - let owner = process.env.OWNER; - let repo = process.env.REPO; - let issue_number = parseInt(process.env.ISSUE_NUMBER || ""); - let run_id = parseInt(process.env.RUN_ID || ""); - - if (!owner || !repo || !(issue_number || run_id)) { - let inputsFromContext = await extractInputs(github, context, core); - owner = owner || inputsFromContext.owner; - repo = repo || inputsFromContext.repo; - issue_number = issue_number || inputsFromContext.issue_number; - run_id = run_id || inputsFromContext.run_id; - } - - /** @type {string[]} */ - let artifactNames = []; - - if (run_id) { - // List artifacts from a single run_id - core.info(`listWorkflowRunArtifacts(${owner}, ${repo}, ${run_id})`); - const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: owner, - repo: repo, - run_id: run_id, - }); - - artifactNames = artifacts.data.artifacts.map((a) => a.name); - } - else { - // TODO: List all artifacts of issue_number - } - - core.info(`artifactNames: ${JSON.stringify(artifactNames)}`) - for (const artifactName of artifactNames) { - // If artifactName has format "key=value", add the key and value as env vars. - // If artifactName does not contain "=", ignore. - // If artifactName contains multiple "=", the key is everything before the first "=", - // and the value is everything else. - const firstEquals = artifactName.indexOf("="); - if (firstEquals !== -1) { - const key = artifactName.substring(0, firstEquals); - const value = artifactName.substring(firstEquals + 1); - core.info(`exportVariable(${key}, ${value})`); - core.exportVariable(key, value); - } - } -}; diff --git a/.github/actions/set-label/action.js b/.github/actions/set-label/action.js deleted file mode 100644 index 9b0c0f52e5f1..000000000000 --- a/.github/actions/set-label/action.js +++ /dev/null @@ -1,53 +0,0 @@ -// @ts-check - -const { extractInputs } = require('../context'); - -/** - * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments - */ -module.exports = async ({ github, context, core }) => { - let owner = process.env.OWNER; - let repo = process.env.REPO; - let issue_number = parseInt(process.env.ISSUE_NUMBER || ""); - - if (!owner || !repo || !issue_number) { - let inputsFromContext = await extractInputs(github, context, core); - owner = owner || inputsFromContext.owner; - repo = repo || inputsFromContext.repo; - issue_number = issue_number || inputsFromContext.issue_number; - } - - let name = process.env.NAME; - if (!name) { - throw new Error(`Invalid name: '${name}'`); - } - - let value = process.env.VALUE; - if (value && value.toLowerCase() === "true") { - await github.rest.issues.addLabels({ - owner: owner, - repo: repo, - issue_number: issue_number, - labels: [name], - }); - } else if (value && value.toLowerCase() === "false") { - try { - await github.rest.issues.removeLabel({ - owner: owner, - repo: repo, - issue_number: issue_number, - name: name, - }); - } - catch (error) { - if (error.status === 404) { - core.info(`Ignoring error: ${error.status} - ${error.message}`); - } - else { - throw error; - } - } - } else { - throw new Error(`Invalid value: '${value}'`); - } -}; diff --git a/.github/actions/set-label/action.yaml b/.github/actions/set-label/action.yaml deleted file mode 100644 index dc05d9658268..000000000000 --- a/.github/actions/set-label/action.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: Set Label -description: Adds or removes label to set state matching value - -# If any inputs are not set, we will attempt to extract them from the event context -inputs: - name: - description: Name of the label - required: true - value: - description: Whether to add or remove the label ("true" or "false") - required: false - default: "true" - owner: - description: The account owner of the repository. The name is not case sensitive. - required: false - repo: - description: The name of the repository without the .git extension. The name is not case sensitive. - required: false - issue_number: - description: The number that identifies the issue. - required: false - -runs: - using: composite - - steps: - - name: Set Label - uses: actions/github-script@v7 - env: - NAME: ${{ inputs.name }} - VALUE: ${{ inputs.value }} - OWNER: ${{ inputs.owner }} - REPO: ${{ inputs.repo }} - ISSUE_NUMBER: ${{ inputs.issue_number }} - with: - script: | - const action = require('./.github/actions/set-label/action.js') - await action({ github, context, core }); diff --git a/.github/actions/update-labels/action.js b/.github/actions/update-labels/action.js new file mode 100644 index 000000000000..be386809b4f3 --- /dev/null +++ b/.github/actions/update-labels/action.js @@ -0,0 +1,102 @@ +// @ts-check + +const { extractInputs } = require("../context"); + +/** + * @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments + */ +module.exports = async ({ github, context, core }) => { + let owner = process.env.OWNER; + let repo = process.env.REPO; + let issue_number = parseInt(process.env.ISSUE_NUMBER || ""); + let run_id = parseInt(process.env.RUN_ID || ""); + + if (!owner || !repo || !(issue_number || run_id)) { + let inputs = await extractInputs(github, context, core); + owner = owner || inputs.owner; + repo = repo || inputs.repo; + issue_number = issue_number || inputs.issue_number; + run_id = run_id || inputs.run_id; + } + + /** @type {string[]} */ + let artifactNames = []; + + if (run_id) { + // List artifacts from a single run_id + core.info(`listWorkflowRunArtifacts(${owner}, ${repo}, ${run_id})`); + const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: owner, + repo: repo, + run_id: run_id, + }); + + artifactNames = artifacts.data.artifacts.map((a) => a.name); + } else { + // TODO: List all artifacts of issue_number + } + + core.info(`artifactNames: ${JSON.stringify(artifactNames)}`); + + /** @type {string[]} */ + const labelsToAdd = []; + + /** @type {string[]} */ + const labelsToRemove = []; + + for (const artifactName of artifactNames) { + // If artifactName has format "label-name=true|false", add or remove the label + // Else, if artifactName has format "label-name=other-string", throw an error + // Else, if artifactName does not start with "label-", ignore it + const firstEquals = artifactName.indexOf("="); + if (firstEquals !== -1) { + const key = artifactName.substring(0, firstEquals); + const value = artifactName.substring(firstEquals + 1); + + if (key.startsWith("label-")) { + const name = key.substring("label-".length); + if (value === "true") { + labelsToAdd.push(name); + } else if (value === "false") { + labelsToRemove.push(name); + } else { + throw new Error( + `Invalid value for label '${name}': ${value}. Expected "true" or "false".`, + ); + } + } + } + } + + core.info(`labelsToAdd: ${JSON.stringify(labelsToAdd)}`); + core.info(`labelsToRemove: ${JSON.stringify(labelsToRemove)}`); + + if (labelsToAdd.length > 0) { + await github.rest.issues.addLabels({ + owner: owner, + repo: repo, + issue_number: issue_number, + labels: labelsToAdd, + }); + } + + if (labelsToRemove.length > 0) { + // Must loop over labelsToRemove ourselves, since GitHub doesn't expose a REST API to remove in bulk. + for (const name in labelsToRemove) { + try { + await github.rest.issues.removeLabel({ + owner: owner, + repo: repo, + issue_number: issue_number, + name: name, + }); + } catch (error) { + if (error.status === 404) { + core.info(`Ignoring error: ${error.status} - ${error.message}`); + } else { + throw error; + } + } + } + } +}; diff --git a/.github/actions/get-keyvalue-artifacts/action.yaml b/.github/actions/update-labels/action.yaml similarity index 67% rename from .github/actions/get-keyvalue-artifacts/action.yaml rename to .github/actions/update-labels/action.yaml index 5bdaa1e14e6a..971f583b4acb 100644 --- a/.github/actions/get-keyvalue-artifacts/action.yaml +++ b/.github/actions/update-labels/action.yaml @@ -1,5 +1,5 @@ -name: Get KeyValue Artifacts -description: Sets env vars corresponding to keys and values encoded in artifact names +name: Update Labels +description: Adds or removes label to set state matching value # If any inputs are not set, we will attempt to extract them from the event context inputs: @@ -9,25 +9,25 @@ inputs: repo: description: The name of the repository without the .git extension. The name is not case sensitive. required: false - run_id: - description: The unique identifier of the workflow run. - required: false issue_number: - description: The number that identifies the issue. + description: Updates labels from all completed workflows associated with head commit of issue. + required: false + run_id: + description: Updates labels from a single completed workflow. required: false runs: using: composite steps: - - name: Get KeyValue Artifacts + - name: Set Label uses: actions/github-script@v7 env: OWNER: ${{ inputs.owner }} REPO: ${{ inputs.repo }} - RUN_ID: ${{ inputs.run_id }} ISSUE_NUMBER: ${{ inputs.issue_number }} + RUN_ID: ${{ inputs.run_id }} with: script: | - const action = require('./.github/actions/get-keyvalue-artifacts/action.js') + const action = require('./.github/actions/update-labels/action.js') await action({ github, context, core }); diff --git a/.github/workflows/update-labels.yaml b/.github/workflows/update-labels.yaml index e313df4c813a..5a2435c46012 100644 --- a/.github/workflows/update-labels.yaml +++ b/.github/workflows/update-labels.yaml @@ -39,29 +39,16 @@ jobs: runs-on: ubuntu-latest - env: - # May be set by get-keyvalue-artifacts. Setting to null here avoids warning in VS Code. - spec-lifecycle-resource-manager: - steps: - uses: actions/checkout@v4 with: sparse-checkout: | .github - - name: Get KeyValue artifacts - uses: ./.github/actions/get-keyvalue-artifacts + - name: Update Labels + uses: ./.github/actions/update-labels with: owner: ${{ inputs.owner }} repo: ${{ inputs.repo }} issue_number: ${{ inputs.issue_number }} run_id: ${{ inputs.run_id }} - - - name: Set Label "brownfield" - uses: ./.github/actions/set-label - with: - name: brownfield - value: ${{ env.spec-lifecycle-resource-manager == 'brownfield' }} - owner: ${{ inputs.owner }} - repo: ${{ inputs.repo }} - issue_number: ${{ inputs.issue_number }} From 072171fe5bf5e8104b232aafb61e33a9bf78e6a0 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 15 Nov 2024 09:01:14 +0000 Subject: [PATCH 64/73] Add comment --- .github/actions/context.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/context.js b/.github/actions/context.js index 020a4a86089d..0b1eb8b5b260 100644 --- a/.github/actions/context.js +++ b/.github/actions/context.js @@ -1,6 +1,9 @@ // @ts-check /** + * Extracts inputs from context based on event name and properties. + * run_id is only defined for "workflow_run:completed" events. + * * @param {import('github-script').AsyncFunctionArguments['github']} github * @param {import('github-script').AsyncFunctionArguments['context']} context * @param {import('github-script').AsyncFunctionArguments['core']} core From c833eb95f6afb28d15e36768283f70fa0551557f Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 27 Nov 2024 01:57:03 +0000 Subject: [PATCH 65/73] WIP: Get workflows from head_sha --- .github/actions/context.js | 3 ++- .github/actions/update-labels/action.js | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/actions/context.js b/.github/actions/context.js index 0b1eb8b5b260..756e5395b496 100644 --- a/.github/actions/context.js +++ b/.github/actions/context.js @@ -7,7 +7,7 @@ * @param {import('github-script').AsyncFunctionArguments['github']} github * @param {import('github-script').AsyncFunctionArguments['context']} context * @param {import('github-script').AsyncFunctionArguments['core']} core - * @returns {Promise<{owner: string, repo: string, issue_number: number, run_id: number }>} + * @returns {Promise<{owner: string, repo: string, head_sha: string, issue_number: number, run_id: number }>} */ async function extractInputs(github, context, core) { core.info(`extractInputs(${context.eventName}, ${context.payload.action})`); @@ -22,6 +22,7 @@ async function extractInputs(github, context, core) { const inputs = { owner: payload.repository.owner.login, repo: payload.repository.name, + head_sha: payload.pull_request.head.sha, issue_number: payload.number, run_id: NaN }; diff --git a/.github/actions/update-labels/action.js b/.github/actions/update-labels/action.js index be386809b4f3..969640355fb0 100644 --- a/.github/actions/update-labels/action.js +++ b/.github/actions/update-labels/action.js @@ -33,6 +33,13 @@ module.exports = async ({ github, context, core }) => { artifactNames = artifacts.data.artifacts.map((a) => a.name); } else { + const workflows = await github.rest.actions.listWorkflowRunsForRepo({ + owner, + repo, + event: 'pull_request', + status: 'completed' + head_sha: context.payload. + }); // TODO: List all artifacts of issue_number } From ec34ded8875922ec665a0cc954a7add1088d7ccf Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 9 Dec 2024 20:04:11 +0000 Subject: [PATCH 66/73] Remove labeled and unlabeled triggers --- .github/actions/update-labels/action.js | 10 ++-------- .github/workflows/update-labels.yaml | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/actions/update-labels/action.js b/.github/actions/update-labels/action.js index 969640355fb0..0e4d85dab2ab 100644 --- a/.github/actions/update-labels/action.js +++ b/.github/actions/update-labels/action.js @@ -33,14 +33,8 @@ module.exports = async ({ github, context, core }) => { artifactNames = artifacts.data.artifacts.map((a) => a.name); } else { - const workflows = await github.rest.actions.listWorkflowRunsForRepo({ - owner, - repo, - event: 'pull_request', - status: 'completed' - head_sha: context.payload. - }); - // TODO: List all artifacts of issue_number + // TODO: List all artifacts of all workflows associated with issue_number + throw new Error("Required input 'run_id' not found in env or context"); } core.info(`artifactNames: ${JSON.stringify(artifactNames)}`); diff --git a/.github/workflows/update-labels.yaml b/.github/workflows/update-labels.yaml index 5a2435c46012..d1663f57ae8c 100644 --- a/.github/workflows/update-labels.yaml +++ b/.github/workflows/update-labels.yaml @@ -1,9 +1,9 @@ name: Update Labels on: - # If a pull request is manually labeled or unlabeled, get all artifacts associated with PR, and update labels - pull_request: - types: [labeled, unlabeled] + # TODO: If a pull request is manually labeled or unlabeled, get all artifacts associated with PR, and update labels + # pull_request: + # types: [labeled, unlabeled] # If an upstream workflow if completed, get only the artifacts from that workflow, and update labels workflow_run: workflows: ["TypeSpec Requirement"] From 5a9cf1f3154b9a8a58c5aefd0b5d77a2854e1396 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 9 Dec 2024 21:26:30 +0000 Subject: [PATCH 67/73] Add head_sha to workflow_run inputs --- .github/actions/context.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/context.js b/.github/actions/context.js index 756e5395b496..8dce041c2f22 100644 --- a/.github/actions/context.js +++ b/.github/actions/context.js @@ -77,6 +77,7 @@ async function extractInputs(github, context, core) { const inputs = { owner: payload.workflow_run.repository.owner.login, repo: payload.workflow_run.repository.name, + head_sha: payload.workflow_run.head_sha, issue_number: issue_number, run_id: payload.workflow_run.id, }; From f0806c19b69cddddc0b717c282d7690a030cd361 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 9 Dec 2024 21:26:39 +0000 Subject: [PATCH 68/73] Improve comments --- .github/actions/add-label-artifact/action.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/add-label-artifact/action.yaml b/.github/actions/add-label-artifact/action.yaml index 72ecdec81ef9..28c4b294655c 100644 --- a/.github/actions/add-label-artifact/action.yaml +++ b/.github/actions/add-label-artifact/action.yaml @@ -1,5 +1,5 @@ name: Add Label Artifact -description: Uploads an empty artifact named `label-${name}=${value}`, that's consumed by update-labels.yaml +description: Uploads an empty artifact named `label-${name}=${value}`, that's consumed by action "update-labels" inputs: name: @@ -17,9 +17,7 @@ runs: run: "> $RUNNER_TEMP/empty.txt" shell: bash - # A recommended format is "key=value". The maximum length is reported to be 260 characters. - # - # A full list of invalid artifact name characters is documented here: + # The maximum length is reported to be 260 characters. A full list of invalid artifact name characters is documented here: # https://github.com/actions/toolkit/blob/main/packages/artifact/src/internal/upload/path-and-artifact-name-validation.ts - uses: actions/upload-artifact@v4 with: From 2df306a61821d36fcc6306f9f5b867a97a926a41 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 9 Dec 2024 21:26:48 +0000 Subject: [PATCH 69/73] Improve description --- .github/actions/update-labels/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/update-labels/action.yaml b/.github/actions/update-labels/action.yaml index 971f583b4acb..868a47ace701 100644 --- a/.github/actions/update-labels/action.yaml +++ b/.github/actions/update-labels/action.yaml @@ -10,7 +10,7 @@ inputs: description: The name of the repository without the .git extension. The name is not case sensitive. required: false issue_number: - description: Updates labels from all completed workflows associated with head commit of issue. + description: The issue that should have it's labels updated. required: false run_id: description: Updates labels from a single completed workflow. From b4c1d74440f6459127e0ec96c6e1446153fdbaac Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 9 Dec 2024 21:30:00 +0000 Subject: [PATCH 70/73] Use "for of" instead of "for in" --- .github/actions/update-labels/action.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/update-labels/action.js b/.github/actions/update-labels/action.js index 0e4d85dab2ab..ffd734584b14 100644 --- a/.github/actions/update-labels/action.js +++ b/.github/actions/update-labels/action.js @@ -83,7 +83,7 @@ module.exports = async ({ github, context, core }) => { if (labelsToRemove.length > 0) { // Must loop over labelsToRemove ourselves, since GitHub doesn't expose a REST API to remove in bulk. - for (const name in labelsToRemove) { + for (const name of labelsToRemove) { try { await github.rest.issues.removeLabel({ owner: owner, From 290545b3d9dcbfbc2e7a109fa472cc8a7510567f Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 9 Dec 2024 21:31:10 +0000 Subject: [PATCH 71/73] grammar --- .github/actions/update-labels/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/update-labels/action.yaml b/.github/actions/update-labels/action.yaml index 868a47ace701..f7ba84e5322a 100644 --- a/.github/actions/update-labels/action.yaml +++ b/.github/actions/update-labels/action.yaml @@ -10,7 +10,7 @@ inputs: description: The name of the repository without the .git extension. The name is not case sensitive. required: false issue_number: - description: The issue that should have it's labels updated. + description: The issue that should have its labels updated. required: false run_id: description: Updates labels from a single completed workflow. From 16de04c21ba2d9c9d83974b2ee35f51f14508e2f Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 9 Dec 2024 21:32:36 +0000 Subject: [PATCH 72/73] Revert accidental change --- eng/common/scripts/logging.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/logging.ps1 b/eng/common/scripts/logging.ps1 index 162e52a8216d..1b459d004ad0 100644 --- a/eng/common/scripts/logging.ps1 +++ b/eng/common/scripts/logging.ps1 @@ -50,7 +50,8 @@ function LogSuccess { Write-Host "${green}$args${reset}" } -function LogErrorForFile($file, $errorString) { +function LogErrorForFile($file, $errorString) +{ if (Test-SupportsDevOpsLogging) { Write-Host ("##vso[task.logissue type=error;sourcepath=$file;linenumber=1;columnnumber=1;]$errorString" -replace "`n", "%0D%0A") } From 8791aeeeb97e946795fa6940555e242e92173b60 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 9 Dec 2024 21:47:50 +0000 Subject: [PATCH 73/73] Improve description --- .github/actions/update-labels/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/update-labels/action.yaml b/.github/actions/update-labels/action.yaml index f7ba84e5322a..d87902dcba48 100644 --- a/.github/actions/update-labels/action.yaml +++ b/.github/actions/update-labels/action.yaml @@ -1,5 +1,5 @@ name: Update Labels -description: Adds or removes label to set state matching value +description: Adds or removes labels to set state matching artifact names # If any inputs are not set, we will attempt to extract them from the event context inputs: