wip: switch to workflow_dispatch #381
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: Test and Build | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| pr_number: | ||
| description: 'The pull request number to build' | ||
| required: true | ||
| type: 'string' | ||
| permissions: | ||
| contents: read | ||
| statuses: write | ||
| jobs: | ||
| build: | ||
| name: Prepare Build Environment | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| head_sha: ${{ steps.get_pr_data.outputs.head_sha }} | ||
| head_ref: ${{ steps.get_pr_data.outputs.head_ref }} | ||
| base_ref: ${{ steps.get_pr_data.outputs.base_ref }} | ||
| pr_number: ${{ steps.get_pr_data.outputs.pr_number }} | ||
| steps: | ||
| - name: Extract PR Data | ||
| id: get_pr_data | ||
| uses: actions/github-script@v8 | ||
| with: | ||
| script: | | ||
| const prNumber = ${{ github.event.inputs.pr_number }}; | ||
| if (!prNumber) { | ||
| core.setFailed('Pull request number not found in the event payload.'); | ||
| return; | ||
| } | ||
| const { data: pr } = await github.rest.pulls.get({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: prNumber, | ||
| }); | ||
| core.setOutput('head_sha', pr.head.sha); | ||
| core.setOutput('head_ref', pr.head.ref); | ||
| core.setOutput('base_ref', pr.base.ref); | ||
| core.setOutput('pr_number', prNumber); | ||
| - name: Set latest commit status as pending | ||
| uses: myrotvorets/set-commit-status-action@master | ||
| with: | ||
| sha: ${{ steps.get_pr_data.outputs.head_sha }} | ||
| status: pending | ||
| - name: Feeds Package Test Build | ||
| uses: openwrt/actions-shared-workflows/.github/workflows/multi-arch-test-build.yml@main | ||
| env: | ||
| GITHUB_EVENT_NAME: pull_request | ||
| GITHUB_SHA: ${{ steps.get_pr_data.outputs.head_sha }} | ||
| GITHUB_REF: refs/pull/${{ steps.get_pr_data.outputs.pr_number }}/merge | ||
| GITHUB_HEAD_REF: ${{ steps.get_pr_data.outputs.head_ref }} | ||
| GITHUB_BASE_REF: ${{ steps.get_pr_data.outputs.base_ref }} | ||
| - name: Set latest commit status as pending | ||
| uses: myrotvorets/set-commit-status-action@master | ||
| with: | ||
| sha: ${{ steps.get_pr_data.outputs.head_sha }} | ||
| status: ${{ job.status }} | ||