Skip to content

Commit 65e7e82

Browse files
committed
ci: refreshes support/v2 with latest ci changes
1 parent 49f70fa commit 65e7e82

File tree

9 files changed

+204
-10
lines changed

9 files changed

+204
-10
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,4 +472,8 @@ extends:
472472
-t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}" \
473473
"$(Pipeline.Workspace)"
474474
displayName: 'Build and Push Release Image'
475-
condition: contains(variables['Build.SourceBranch'], 'refs/tags/v')
475+
condition: contains(variables['Build.SourceBranch'], 'refs/tags/v')
476+
477+
# once the nuget has been released, fill this form to get the public documentation updated.
478+
# https://dev.azure.com/msft-skilling/Content/_workitems/create/User%20Story?templateId=39fb91e3-64a2-4c8a-83db-b2bdf3603dd3&ownerId=c4a28f90-17ae-4384-b514-7273392b082b
479+
# https://learn.microsoft.com/en-us/dotnet/api/microsoft.openapi

.github/copilot-instructions.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copilot Instructions
2+
3+
## Commit Message Format
4+
5+
Always use conventional commits format when creating commits. Follow this structure:
6+
7+
```
8+
<type>(<scope>): <description>
9+
10+
[optional body]
11+
12+
[optional footer(s)]
13+
```
14+
15+
### Types
16+
17+
- **feat**: A new feature
18+
- **fix**: A bug fix
19+
- **docs**: Documentation only changes
20+
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, etc)
21+
- **refactor**: A code change that neither fixes a bug nor adds a feature
22+
- **perf**: A code change that improves performance
23+
- **test**: Adding missing tests or correcting existing tests
24+
- **build**: Changes that affect the build system or external dependencies
25+
- **ci**: Changes to CI configuration files and scripts
26+
- **chore**: Other changes that don't modify src or test files
27+
28+
### Scope
29+
30+
The scope should indicate the package or area affected (e.g., `library`, `yaml-reader`, `hidi`).
31+
32+
### Examples
33+
34+
```
35+
feat(library): add support for pattern properties
36+
fix(yaml-reader): updates boolean serialization
37+
docs(README): update installation instructions
38+
ci(release): configure automated release workflow
39+
```
40+
41+
### Breaking Changes
42+
43+
If a commit introduces a breaking change, add `BREAKING CHANGE:` in the footer or append `!` after the type/scope:
44+
45+
```
46+
feat(identity-emitter)!: change output format for models
47+
48+
BREAKING CHANGE: The emitter now generates TypeScript interfaces instead of types
49+
```
50+
51+
52+
## Updating the benchmark information
53+
54+
The user might request you update the benchmark information. You might do it on your own if a previous change added new properties to models under **src/Microsoft.OpenApi/Models**. Always use a separate commit for this change.
55+
56+
To do so, run the following script:
57+
58+
```shell
59+
cd performance/benchmark
60+
dotnet run -c Release
61+
```
62+
63+
Then commit the report files using a "chore" commit.

.github/workflows/auto-merge-dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- name: Dependabot metadata
2121
id: metadata
22-
uses: dependabot/fetch-metadata@v2.4.0
22+
uses: dependabot/fetch-metadata@v2.5.0
2323
with:
2424
github-token: "${{ secrets.GITHUB_TOKEN }}"
2525

.github/workflows/ci-cd.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- name: Checkout repository
2222
id: checkout_repo
23-
uses: actions/checkout@v5
23+
uses: actions/checkout@v6
2424
with:
2525
token: ${{ secrets.GITHUB_TOKEN }}
2626
fetch-depth: 0
@@ -41,7 +41,7 @@ jobs:
4141
name: Validate Project for Trimming
4242
runs-on: windows-latest
4343
steps:
44-
- uses: actions/checkout@v5
44+
- uses: actions/checkout@v6
4545

4646
- name: Setup .NET
4747
uses: actions/setup-dotnet@v5
@@ -58,7 +58,7 @@ jobs:
5858
needs: [ci]
5959
steps:
6060
- name: Checkout repository
61-
uses: actions/checkout@v5
61+
uses: actions/checkout@v6
6262

6363
- name: Setup .NET
6464
uses: actions/setup-dotnet@v5
@@ -76,7 +76,7 @@ jobs:
7676
working-directory: ./performance/benchmark
7777

7878
- name: Publish benchmark results
79-
uses: actions/upload-artifact@v5
79+
uses: actions/upload-artifact@v6
8080
with:
8181
if-no-files-found: error
8282
name: benchmark-results

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- name: Checkout repository
2222
id: checkout_repo
23-
uses: actions/checkout@v5
23+
uses: actions/checkout@v6
2424

2525
- name: Setup .NET
2626
uses: actions/setup-dotnet@v5
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Promote Shipped APIs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- support/v2
8+
9+
jobs:
10+
promote-apis:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v6
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Generate GitHub App token
22+
id: app-token
23+
uses: actions/create-github-app-token@v2
24+
with:
25+
app-id: ${{ vars.RELEASE_PLEASE_TOKEN_PROVIDER_APP_ID }}
26+
private-key: ${{ secrets.RELEASE_PLEASE_TOKEN_PROVIDER_PEM }}
27+
28+
- name: Configure git
29+
shell: pwsh
30+
env:
31+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
32+
run: |
33+
git config --global user.name "github-actions[bot]"
34+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
35+
git config --global url."https://x-access-token:$env:GH_TOKEN@github.com/".insteadOf "https://github.com/"
36+
37+
- name: Check for existing PR
38+
id: check_pr
39+
shell: pwsh
40+
env:
41+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
42+
run: |
43+
$branch = "${{ github.ref_name }}"
44+
$prs = gh pr list --state open --head "promote-shipped-apis-$branch" --json number --jq '.[0].number' 2>$null
45+
if ($prs) {
46+
echo "pr_number=$prs" >> $env:GITHUB_OUTPUT
47+
echo "pr_exists=true" >> $env:GITHUB_OUTPUT
48+
Write-Host "Found existing PR: $prs"
49+
} else {
50+
echo "pr_exists=false" >> $env:GITHUB_OUTPUT
51+
Write-Host "No existing PR found"
52+
}
53+
54+
- name: Checkout existing PR branch
55+
if: steps.check_pr.outputs.pr_exists == 'true'
56+
shell: pwsh
57+
run: |
58+
$branch = "${{ github.ref_name }}"
59+
$prBranch = "promote-shipped-apis-$branch"
60+
61+
git fetch origin
62+
git checkout $prBranch
63+
64+
- name: Merge trigger branch into PR branch
65+
if: steps.check_pr.outputs.pr_exists == 'true'
66+
shell: pwsh
67+
run: |
68+
$branch = "${{ github.ref_name }}"
69+
git merge origin/$branch -m "Merge $branch into promote branch"
70+
71+
- name: Run promote unshipped script
72+
shell: pwsh
73+
run: |
74+
& .\scripts\promoteUnshipped.ps1
75+
76+
- name: Check for changes
77+
id: check_changes
78+
shell: pwsh
79+
run: |
80+
$changes = git diff --name-only -- "*Shipped.txt"
81+
if ($changes) {
82+
echo "has_changes=true" >> $env:GITHUB_OUTPUT
83+
Write-Host "Changed files: $changes"
84+
} else {
85+
echo "has_changes=false" >> $env:GITHUB_OUTPUT
86+
Write-Host "No changes detected"
87+
}
88+
89+
- name: Commit and push changes
90+
if: steps.check_changes.outputs.has_changes == 'true'
91+
shell: pwsh
92+
run: |
93+
git add *Shipped.txt
94+
git commit -m "chore: promote shipped APIs"
95+
96+
$branch = "${{ github.ref_name }}"
97+
$prBranch = "promote-shipped-apis-$branch"
98+
git push origin $prBranch
99+
100+
- name: Create new PR
101+
if: steps.check_pr.outputs.pr_exists == 'false' && steps.check_changes.outputs.has_changes == 'true'
102+
shell: pwsh
103+
env:
104+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
105+
run: |
106+
$branch = "${{ github.ref_name }}"
107+
$prBranch = "promote-shipped-apis-$branch"
108+
$title = "automatic promotion of shipped APIs for $branch"
109+
110+
git checkout -b $prBranch
111+
git push origin $prBranch
112+
113+
gh pr create --title "$title" --base "$branch" --head "$prBranch" --body "Automatically promotes unshipped APIs to shipped after running the promotion script."
114+

.github/workflows/release-please-gha.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
release:
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v5
28+
- uses: actions/checkout@v6
2929

3030
- name: Validate PublicAPI.Unshipped.txt files are empty
3131
shell: pwsh

.github/workflows/sonarcloud.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ jobs:
4343
uses: actions/setup-dotnet@v5
4444
with:
4545
dotnet-version: 8.0.x
46-
- uses: actions/checkout@v5
46+
- uses: actions/checkout@v6
4747
with:
4848
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
4949
- name: Cache SonarCloud packages
50-
uses: actions/cache@v4
50+
uses: actions/cache@v5
5151
with:
5252
path: ~/.sonar/cache
5353
key: ${{ runner.os }}-sonar

scripts/promoteUnshipped.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$nullableConstant = "#nullable enable"
2+
$unshippedDocuments = ls *.Unshipped* -R | Select-Object -ExpandProperty FullName
3+
foreach ($unshippedDocumentPath in $unshippedDocuments) {
4+
$shippedDocumentPath = $unshippedDocumentPath -replace '\.Unshipped', '.Shipped'
5+
$unshippedDocumentContent = Get-Content $unshippedDocumentPath -Raw
6+
$unshippedDocumentContent = ($unshippedDocumentContent -replace [regex]::Escape($nullableConstant), '').Trim()
7+
if ([string]::IsNullOrWhiteSpace($unshippedDocumentContent)) {
8+
Write-Host "No content to promote for $unshippedDocumentPath, skipping." -ForegroundColor Yellow
9+
continue
10+
}
11+
Add-Content -Path $shippedDocumentPath -Value $unshippedDocumentContent -Verbose
12+
Set-Content -Path $unshippedDocumentPath -Value $nullableConstant -Verbose
13+
}

0 commit comments

Comments
 (0)