|
| 1 | +name: PR Pre and Post Merge Build |
| 2 | +description: | |
| 3 | + Test a package build pre and post merge. |
| 4 | + When a PR is opened, synchronized or reopened against debian/latest, this workflow will test that the package builds successfully inside the PR. |
| 5 | + The user will want to mark this check as required in branch protection rules to ensure that PRs cannot be merged unless the package builds successfully. |
| 6 | + When a PR is closed AND merged, this workflow will test that debian/latest builds successfully and push the new package to the staging repo. |
| 7 | + This is controled by the is-post-merge input to the reusable workflow, which is set based on the PR action and merged status. |
| 8 | + This workflow will explicitely NOT run on closed but unmerged PRs to avoid unnecessary builds (say in the case of a declined PR) |
| 9 | +
|
| 10 | +on: |
| 11 | + pull_request_target: |
| 12 | + branches: [ debian/latest ] |
| 13 | + types: [ opened, synchronize, reopened, closed ] |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + |
| 20 | + build: |
| 21 | + |
| 22 | + # This condition ensures that the job runs for all PR actions except closed unmerged, |
| 23 | + # i.e., it runs for opened, synchronize, reopened (pre-merge) and closed merged (post-merge). |
| 24 | + if: ${{ github.event.action != 'closed' || github.event.pull_request.merged == true }} |
| 25 | + uses: qualcomm-linux/qcom-build-utils/.github/workflows/qcom-build-pkg-reusable-workflow.yml@main |
| 26 | + with: |
| 27 | + qcom-build-utils-ref: main |
| 28 | + |
| 29 | + # PRE-MERGE: use the PR head branch (github.head_ref) |
| 30 | + # POST-MERGE: use the base branch name from the PR (e.g. "debian/latest") |
| 31 | + debian-ref: ${{ (github.event.action == 'closed' && github.event.pull_request.merged) && github.event.pull_request.base.ref || github.head_ref }} |
| 32 | + run-abi-checker: true |
| 33 | + # True if the PR was merged (i.e. post-merge): closed & merged |
| 34 | + is-post-merge: ${{ github.event.action == 'closed' && github.event.pull_request.merged == true }} |
| 35 | + |
| 36 | + secrets: |
| 37 | + TOKEN: ${{secrets.DEB_PKG_BOT_CI_TOKEN}} |
0 commit comments