From 5785c38f0fe1bcbb37e04aa8a2f3f679375ca7fc Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Sat, 14 Nov 2026 23:18:18 +0100 Subject: [PATCH 1/2] Run the verify-api action on this repository's own api/ (api/ stale on purpose for the first run) Co-Authored-By: Claude Opus 5.5 --- .github/workflows/verify-api.yml | 33 ++++++++++++++++++++++++++++++++ api/Nullean.PublicApi.Diff.api | 1 - verify-api/action.yml | 9 ++++++--- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/verify-api.yml diff --git a/.github/workflows/verify-api.yml b/.github/workflows/verify-api.yml new file mode 100644 index 0000000..43c1e20 --- /dev/null +++ b/.github/workflows/verify-api.yml @@ -0,0 +1,33 @@ +name: verify-api + +# The verify-api action, run from this checkout with the released tool, on this repository's own api/: it proves the +# action end to end on every pull request, and keeps a comment when api/ is out of date. +on: + pull_request: + +permissions: + contents: read + +jobs: + verify-api: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write # the comment + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: jdx/mise-action@b44d12e7d0d8ee7461bb893e1b1993500433185b # v5.2.7 + with: + cache: false + env: + MISE_JOBS: "1" + - run: dotnet build src/Nullean.PublicApi.Diff -c Release + - uses: ./verify-api + with: + directory: api + projects: | + src/Nullean.PublicApi/Nullean.PublicApi.csproj + src/Nullean.PublicApi.Diff/Nullean.PublicApi.Diff.csproj + comment: 'true' diff --git a/api/Nullean.PublicApi.Diff.api b/api/Nullean.PublicApi.Diff.api index 39a275b..f873e80 100644 --- a/api/Nullean.PublicApi.Diff.api +++ b/api/Nullean.PublicApi.Diff.api @@ -50,7 +50,6 @@ namespace Nullean.PublicApi.Diff IReadOnlyList NotExtensionPoints { get; init; } sealed class ApiComparisonResult - IEnumerable Breaking { get; } IReadOnlyList Changes { get; } SuggestedVersionChange Suggest(Version? baseline = null) diff --git a/verify-api/action.yml b/verify-api/action.yml index 300c048..bcf436e 100644 --- a/verify-api/action.yml +++ b/verify-api/action.yml @@ -117,7 +117,7 @@ runs: SUGGESTED: ${{ steps.verify.outputs.suggested-change }} run: | marker='' - existing=$(gh api "repos/$REPOSITORY/issues/$PULL_REQUEST/comments" --paginate --jq ".[] | select(.body | startswith(\"$marker\")) | .id" | head -n 1) + existing=$(gh api "repos/$REPOSITORY/issues/$PULL_REQUEST/comments" --paginate --jq ".[] | select(.body | startswith(\"$marker\")) | .id" | head -n 1 || true) body="$RUNNER_TEMP/assembly-differ-verify.md" if [ "$CODE" = "0" ]; then # only an earlier comment is updated: a pull request whose files always matched gets none @@ -133,10 +133,13 @@ runs: else exit 0 fi + # a pull request from a fork gets a token that cannot write: say so, and leave failing to the check below if [ -n "$existing" ]; then - gh api -X PATCH "repos/$REPOSITORY/issues/comments/$existing" -F "body=@$body" > /dev/null + gh api -X PATCH "repos/$REPOSITORY/issues/comments/$existing" -F "body=@$body" > /dev/null || + echo "::warning title=assembly-differ::could not update the comment; the token needs pull-requests: write" else - gh api -X POST "repos/$REPOSITORY/issues/$PULL_REQUEST/comments" -F "body=@$body" > /dev/null + gh api -X POST "repos/$REPOSITORY/issues/$PULL_REQUEST/comments" -F "body=@$body" > /dev/null || + echo "::warning title=assembly-differ::could not comment; the token needs pull-requests: write" fi - name: Fail when the files do not match From 0ea82cca415c3e75752421217088697e2c25a522 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Sat, 14 Nov 2026 23:23:13 +0100 Subject: [PATCH 2/2] Restore api/, which the first run showed the action reporting Co-Authored-By: Claude Opus 5.5 --- api/Nullean.PublicApi.Diff.api | 1 + 1 file changed, 1 insertion(+) diff --git a/api/Nullean.PublicApi.Diff.api b/api/Nullean.PublicApi.Diff.api index f873e80..39a275b 100644 --- a/api/Nullean.PublicApi.Diff.api +++ b/api/Nullean.PublicApi.Diff.api @@ -50,6 +50,7 @@ namespace Nullean.PublicApi.Diff IReadOnlyList NotExtensionPoints { get; init; } sealed class ApiComparisonResult + IEnumerable Breaking { get; } IReadOnlyList Changes { get; } SuggestedVersionChange Suggest(Version? baseline = null)