diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76124d0c..8e1a7f34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,20 @@ on: types: [opened, synchronize, reopened] merge_group: branches: [master] + workflow_dispatch: + inputs: + pull_request: + description: Pull request number + required: true + type: string + head_ref: + description: Pull request head branch + required: true + type: string + base_ref: + description: Pull request base branch + required: true + type: string permissions: contents: read @@ -53,6 +67,9 @@ jobs: - name: SonarCloud Code Analysis if: ${{ steps.sonar-token.outputs.available == 'true' && github.repository == 'poolifier/poolifier-web-worker' }} uses: sonarsource/sonarqube-scan-action@v8.2 + with: + args: >- + ${{ github.event_name == 'workflow_dispatch' && format('-Dsonar.pullrequest.key={0} -Dsonar.pullrequest.branch={1} -Dsonar.pullrequest.base={2}', inputs.pull_request, inputs.head_ref, inputs.base_ref) || '' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 9897bd8d..7368982f 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -14,7 +14,9 @@ jobs: if: github.repository == 'poolifier/poolifier-web-worker' permissions: + actions: write contents: write + issues: write pull-requests: write outputs: @@ -27,6 +29,23 @@ jobs: config-file: .github/release-please/config.json manifest-file: .github/release-please/manifest.json + - name: Dispatch CI for release pull request + if: ${{ steps.release.outputs.prs_created == 'true' }} + env: + GH_TOKEN: ${{ github.token }} + RELEASE_PR: ${{ steps.release.outputs.pr }} + run: | + pull_request=$(jq -r '.number' <<< "$RELEASE_PR") + head_ref=$(jq -r '.headBranchName' <<< "$RELEASE_PR") + base_ref=$(jq -r '.baseBranchName' <<< "$RELEASE_PR") + + gh workflow run ci.yml \ + --repo "${{ github.repository }}" \ + --ref "$head_ref" \ + --raw-field pull_request="$pull_request" \ + --raw-field head_ref="$head_ref" \ + --raw-field base_ref="$base_ref" + build-release: needs: release-please runs-on: ubuntu-latest