File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : PR Playground Preview
2+
3+ on :
4+ workflow_run :
5+ workflows : ["Test"]
6+ types :
7+ - completed
8+
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
11+ cancel-in-progress : true
12+
13+ permissions : {}
14+
15+ jobs :
16+ playground-preview :
17+ name : Add Playground preview to PR
18+ runs-on : ubuntu-24.04
19+ if : >
20+ github.event.workflow_run.event == 'pull_request' &&
21+ github.event.workflow_run.conclusion == 'success'
22+ permissions :
23+ contents : read
24+ pull-requests : write
25+
26+ steps :
27+ - name : Get PR number
28+ id : pr
29+ uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
30+ with :
31+ script : |
32+ const prs = await github.rest.pulls.list({
33+ owner: context.repo.owner,
34+ repo: context.repo.repo,
35+ head: `${context.payload.workflow_run.head_repository.owner.login}:${context.payload.workflow_run.head_branch}`,
36+ state: 'open',
37+ });
38+ if (!prs.data.length) throw new Error('No open PR found for this branch');
39+ core.setOutput('number', prs.data[0].number);
40+
41+ - name : Post Playground preview button
42+ uses : WordPress/action-wp-playground-pr-preview@c8607529dac8d2bf9a1e8493865fc97cd1c3c87b # v2
43+ with :
44+ mode : append-to-description
45+ plugin-path : .
46+ pr-number : ${{ steps.pr.outputs.number }}
47+ github-token : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments