Skip to content

Commit 328b139

Browse files
committed
add public API marking workflow
Introduces a new GitHub Actions workflow to mark the public API as shipped. Includes logic for handling changes and pushing updates when necessary. Adjusts `mark-shipped.ps1` to streamline handling of unshipped files.
1 parent 83f61f4 commit 328b139

File tree

3 files changed

+54
-8
lines changed

3 files changed

+54
-8
lines changed

.github/workflows/mkdocs.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ env:
77
DOTNET_CLI_TELEMETRY_OPTOUT: 1
88
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
99
DOTNET_NOLOGO: 1
10-
10+
1111
defaults:
1212
run:
1313
shell: pwsh
14-
14+
1515
jobs:
1616
docs:
1717
name: Update Markdown (embedded snippets)
@@ -20,28 +20,31 @@ jobs:
2020
-
2121
name: Checkout
2222
uses: actions/checkout@v5
23+
if: github.event_name == 'push'
24+
with:
25+
token: ${{ secrets.PUSH_GITHUB_TOKEN }}
2326
-
2427
name: Setup .NET SDK
2528
uses: actions/setup-dotnet@v5
2629
with:
2730
global-json-file: global.json
28-
-
31+
-
2932
name: Run MarkdownSnippets
3033
run: |
3134
dotnet tool install --global MarkdownSnippets.Tool
3235
mdsnippets --write-header false
3336
working-directory: ${{ github.workspace }}/docs/input
34-
-
37+
-
3538
name: Check for changes
3639
id: status
3740
run: |
3841
if ($null -ne (git status --porcelain)) { echo "has_changes=1"; echo "has_changes=1" >> $env:GITHUB_OUTPUT }
39-
-
42+
-
4043
name: Push changes
4144
run: |
4245
git add --verbose .
4346
git config user.name 'Artur Stolear'
4447
git config user.email '[email protected]'
4548
git commit -m 'Docs changes' --allow-empty
4649
git push --force
47-
if: steps.status.outputs.has_changes == '1'
50+
if: steps.status.outputs.has_changes == '1'

.github/workflows/public-api.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Mark public API as shipped
2+
3+
on:
4+
workflow_dispatch:
5+
repository_dispatch:
6+
types: [ publish-release ]
7+
8+
defaults:
9+
run:
10+
shell: pwsh
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
homebrew:
17+
permissions:
18+
contents: none
19+
name: Mark public API as shipped
20+
runs-on: ubuntu-24.04
21+
steps:
22+
-
23+
name: Checkout
24+
uses: actions/checkout@v5
25+
if: github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch'
26+
with:
27+
token: ${{ secrets.PUSH_GITHUB_TOKEN }}
28+
-
29+
name: Mark public API as shipped
30+
run: ./src/mark-shipped.ps1
31+
-
32+
name: Check for changes
33+
id: status
34+
run: |
35+
if ($null -ne (git status --porcelain)) { echo "has_changes=1"; echo "has_changes=1" >> $env:GITHUB_OUTPUT }
36+
-
37+
name: Push changes
38+
run: |
39+
git add --verbose .
40+
git config user.name 'Artur Stolear'
41+
git config user.email '[email protected]'
42+
git commit -m 'Mark public API as shipped' --allow-empty
43+
git push --force
44+
if: steps.status.outputs.has_changes == '1'

src/mark-shipped.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ function MarkShipped([string]$dir) {
3030
}
3131

3232
$shipped | Sort-Object -Unique | Where-Object { -not $removed.Contains($_) } | Out-File $shippedFilePath -Encoding Ascii
33-
"#nullable enable" | Out-File "PublicAPI.empty.txt" -Encoding Ascii
34-
Copy-Item ./PublicAPI.empty.txt $unshippedFilePath
33+
"#nullable enable" | Out-File $unshippedFilePath -Encoding Ascii
3534
}
3635

3736
try {

0 commit comments

Comments
 (0)