Repository navigation
Add share sheet support #57
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR API diff | ||
|
Check warning on line 1 in .github/workflows/apidiff.yml
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened, synchronize, reopened] | ||
| issue_comment: | ||
| types: [created] | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| jobs: | ||
| api-diff: | ||
| if: >- | ||
| ( | ||
| github.event_name == 'pull_request_target' && | ||
| contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.pull_request.author_association) | ||
| ) || | ||
| ( | ||
| github.event_name == 'issue_comment' && | ||
| github.event.issue.pull_request && | ||
| github.event.comment.body == '/api-diff' && | ||
| contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) | ||
| ) | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: Get pull request references | ||
| id: pull_request | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const pullNumber = context.eventName === 'pull_request_target' | ||
| ? context.payload.pull_request.number | ||
| : context.payload.issue.number; | ||
| const pullRequest = await github.rest.pulls.get({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: pullNumber | ||
| }); | ||
| core.setOutput('number', pullRequest.data.number); | ||
| core.setOutput('head_sha', pullRequest.data.head.sha); | ||
| core.setOutput('base_sha', pullRequest.data.base.sha); | ||
| - name: Set up .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: 8.0.x | ||
| - name: Install generator | ||
| run: dotnet tool install --global dotMorten.OmdGenerator | ||
| - name: Generate API diff | ||
| shell: bash | ||
| run: | | ||
| generateomd \ | ||
| --source=src/WinUIEx/WinUIEx.csproj \ | ||
| --gitRepo=${{ github.server_url }}/${{ github.repository }} \ | ||
| --sourceRef=${{ steps.pull_request.outputs.head_sha }} \ | ||
| --compareRef=${{ steps.pull_request.outputs.base_sha }} \ | ||
| --format=md \ | ||
| --output=api-diff | ||
| - name: Check whether API changes were found | ||
| id: api_diff | ||
| shell: bash | ||
| run: | | ||
| if grep -q '^namespace ' api-diff.md; then | ||
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| - name: Write pull request number | ||
| shell: bash | ||
| run: echo "${{ steps.pull_request.outputs.number }}" > pr-number.txt | ||
| - name: Upload API diff | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: api-diff | ||
| path: | | ||
| api-diff.md | ||
| pr-number.txt | ||
| retention-days: 1 | ||