Check Extensions Summary #198
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: Check Extensions Summary | |
| on: | |
| workflow_dispatch: | |
| workflow_run: | |
| workflows: | |
| - "Check Extensions" | |
| types: | |
| - completed | |
| permissions: | |
| pull-requests: write | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-summary: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create GitHub App token | |
| uses: actions/create-github-app-token@v3 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.APP_ID }} | |
| private-key: ${{ secrets.APP_KEY }} | |
| - name: Get GitHub App User ID | |
| id: get-user-id | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| APP_SLUG: ${{ steps.app-token.outputs.app-slug }} | |
| run: echo "user-id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id)" >> "${GITHUB_OUTPUT}" | |
| - name: Download artifact | |
| id: download-artifact | |
| continue-on-error: true | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: extensions-check-summary | |
| path: "${{ runner.temp }}/artifacts/" | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ steps.app-token.outputs.token }} | |
| - name: Generate summary report | |
| if: steps.download-artifact.outputs.download-path != '' | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| APP_SLUG: ${{ steps.app-token.outputs.app-slug }} | |
| USER_ID: ${{ steps.get-user-id.outputs.user-id }} | |
| DOWNLOAD_PATH: ${{ steps.download-artifact.outputs.download-path }} | |
| shell: bash | |
| run: | | |
| git config --global user.name '${APP_SLUG}[bot]' | |
| git config --global user.email '${USER_ID}+${APP_SLUG}[bot]@users.noreply.github.com' | |
| gh pr comment "$(cat ${DOWNLOAD_PATH}/pr_number)" \ | |
| --body-file ${DOWNLOAD_PATH}/summary.md \ | |
| --create-if-none \ | |
| --edit-last \ | |
| --repo ${GITHUB_REPOSITORY} | |
| cat ${DOWNLOAD_PATH}/summary.md >> "${GITHUB_STEP_SUMMARY}" | |
| - name: Workflow completion | |
| env: | |
| DOWNLOAD_PATH: ${{ steps.download-artifact.outputs.download-path }} | |
| run: | | |
| if [[ "${DOWNLOAD_PATH}" == "" ]]; then | |
| echo "ℹ️ No artifacts found, workflow completed successfully" | |
| echo "ℹ️ No artifacts found, workflow completed successfully" >> "${GITHUB_STEP_SUMMARY}" | |
| fi |