diff --git a/.github/workflows/proposed-9.0.yml b/.github/workflows/proposed-9.0.yml index 42c6e083a..c2a1ae849 100644 --- a/.github/workflows/proposed-9.0.yml +++ b/.github/workflows/proposed-9.0.yml @@ -17,7 +17,9 @@ concurrency: jobs: call-reusable-build: - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + if: >- + (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || + (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main') uses: ./.github/workflows/build-release.yml with: stream: proposed @@ -26,17 +28,37 @@ jobs: comment-installer-urls: name: Comment Installer URLs needs: call-reusable-build - if: github.event_name == 'pull_request' runs-on: ubuntu-latest permissions: pull-requests: write steps: + - name: Find and set PR number and SHA into output vars + id: pr-info + env: + GH_TOKEN: ${{ github.token }} + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + PR_NUMBER="${{ github.event.pull_request.number }}" + HEAD_SHA="${{ github.event.pull_request.head.sha }}" + else + PR_NUMBER=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --head "$GITHUB_REF_NAME" \ + --state open \ + --json number \ + --jq '.[0].number') + HEAD_SHA="$GITHUB_SHA" + fi + + echo "number=$PR_NUMBER" >> "$GITHUB_OUTPUT" + echo "sha=$HEAD_SHA" >> "$GITHUB_OUTPUT" - name: Comment installer URLs on PR + if: steps.pr-info.outputs.number != '' env: GH_TOKEN: ${{ github.token }} - PR_NUMBER: ${{ github.event.pull_request.number }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} + PR_NUMBER: ${{ steps.pr-info.outputs.number }} + HEAD_SHA: ${{ steps.pr-info.outputs.sha }} ISO_AMD64: ${{ needs.call-reusable-build.outputs.iso_amd64 }} ISO_ARM64: ${{ needs.call-reusable-build.outputs.iso_arm64 }} run: |