From c5ee639016f1ed4080e63f8dd6e98d10b56138e1 Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 31 Mar 2026 01:41:47 +0900 Subject: remove nested directory for openapi workflows --- .github/workflows/openapi-workflow-run.yml | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/openapi-workflow-run.yml (limited to '.github/workflows/openapi-workflow-run.yml') diff --git a/.github/workflows/openapi-workflow-run.yml b/.github/workflows/openapi-workflow-run.yml new file mode 100644 index 0000000000..9dbd2c40a0 --- /dev/null +++ b/.github/workflows/openapi-workflow-run.yml @@ -0,0 +1,59 @@ +name: OpenAPI Report + +on: + workflow_run: + workflows: + - OpenAPI Check + types: + - completed + +jobs: + metadata: + name: Generate Metadata + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + outputs: + pr_number: ${{ steps.pr_number.outputs.pr_number }} + steps: + - name: Get Pull Request Number + id: pr_number + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HEAD_SHA: ${{ github.event.workflow_run.head_sha }} + run: | + API_RESPONSE=$(gh pr list --repo "${GITHUB_REPOSITORY}" --search "${HEAD_SHA}" --state open --json number) + PR_NUMBER=$(echo "${API_RESPONSE}" | jq '.[0].number') + + echo "repository: ${GITHUB_REPOSITORY}" + echo "sha: ${HEAD_SHA}" + echo "response: ${API_RESPONSE}" + echo "pr: ${PR_NUMBER}" + + echo "pr_number=${PR_NUMBER}" >> "${GITHUB_OUTPUT}" + + comment: + name: Pull Request Comment + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + needs: + - metadata + permissions: + pull-requests: write + actions: read + contents: read + steps: + - name: Download OpenAPI Report + id: download_report + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: openapi-diff-report + path: openapi-diff-report + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Push Comment + uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 + with: + github-token: ${{ secrets.JF_BOT_TOKEN }} + file-path: ${{ steps.download_report.outputs.download-path }}/openapi-changelog.md + pr-number: ${{ needs.metadata.outputs.pr_number }} + comment-tag: openapi-report -- cgit v1.2.3 From 87c8349c6bcb5fe7b1c31cbaba2ef29b4b9a15f6 Mon Sep 17 00:00:00 2001 From: dkanada Date: Fri, 3 Apr 2026 19:52:37 +0900 Subject: fix openapi report and publish workflows --- .github/workflows/openapi-merge.yml | 4 +++- .github/workflows/openapi-pull-request.yml | 18 +++++++++++++++--- .github/workflows/openapi-workflow-run.yml | 6 +++--- 3 files changed, 21 insertions(+), 7 deletions(-) (limited to '.github/workflows/openapi-workflow-run.yml') diff --git a/.github/workflows/openapi-merge.yml b/.github/workflows/openapi-merge.yml index cd990cf5f8..954a835b41 100644 --- a/.github/workflows/openapi-merge.yml +++ b/.github/workflows/openapi-merge.yml @@ -6,7 +6,9 @@ on: tags: - 'v*' -permissions: {} +permissions: + contents: read + actions: read jobs: publish-openapi: diff --git a/.github/workflows/openapi-pull-request.yml b/.github/workflows/openapi-pull-request.yml index b583fb54d1..dc8ba3ab3e 100644 --- a/.github/workflows/openapi-pull-request.yml +++ b/.github/workflows/openapi-pull-request.yml @@ -63,10 +63,22 @@ jobs: name: openapi-base path: openapi-base - name: Detect Changes - uses: jellyfin/openapi-diff-action@9274f6bda9d01ab091942a4a8334baa53692e8a4 # v1.0.0 + runs-on: ubuntu-latest id: openapi-diff with: old-spec: openapi-base/openapi.json new-spec: openapi-head/openapi.json - markdown: openapi-changelog.md - github-token: ${{ secrets.GITHUB_TOKEN }} + run: | + sed 's:allOf:oneOf:g' openapi-head/openapi.json + sed 's:allOf:oneOf:g' openapi-base/openapi.json + + mkdir -p /tmp/openapi-report + mv openapi-head/openapi.json /tmp/openapi-report/head.json + mv openapi-base/openapi.json /tmp/openapi-report/base.json + + docker run -v /tmp/openapi-report:/data openapitools/openapi-diff:2.1.6 /data/base.json /data/head.json --state -l ERROR --markdown /data/openapi-report.md + - name: Upload Artifact + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: openapi-report + path: /tmp/openapi-report/openapi-report.md diff --git a/.github/workflows/openapi-workflow-run.yml b/.github/workflows/openapi-workflow-run.yml index 9dbd2c40a0..0f9e84e56b 100644 --- a/.github/workflows/openapi-workflow-run.yml +++ b/.github/workflows/openapi-workflow-run.yml @@ -46,14 +46,14 @@ jobs: id: download_report uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: - name: openapi-diff-report - path: openapi-diff-report + name: openapi-report + path: openapi-report run-id: ${{ github.event.workflow_run.id }} github-token: ${{ secrets.GITHUB_TOKEN }} - name: Push Comment uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 with: github-token: ${{ secrets.JF_BOT_TOKEN }} - file-path: ${{ steps.download_report.outputs.download-path }}/openapi-changelog.md + file-path: ${{ steps.download_report.outputs.download-path }}/openapi-report.md pr-number: ${{ needs.metadata.outputs.pr_number }} comment-tag: openapi-report -- cgit v1.2.3