Skip to content

Commit 1127e4b

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 1127e4b

File tree

3 files changed

+58
-8
lines changed

3 files changed

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