|
14 | 14 |
|
15 | 15 | permissions: |
16 | 16 | contents: read |
| 17 | + deployments: write |
17 | 18 | issues: write |
18 | 19 | pull-requests: write |
19 | 20 |
|
|
46 | 47 | # comments. This checkout is safe because it does not set `ref:`; GitHub checks |
47 | 48 | # out the base branch's trusted workflow code, not the fork head. Do not add |
48 | 49 | # `ref: ${{ github.event.pull_request.head.sha }}` here without re-evaluating |
49 | | - # the trust boundary. |
| 50 | + # the trust boundary. All local composite actions below are therefore loaded from |
| 51 | + # trusted base-branch code; keep them that way when changing this workflow. |
50 | 52 | - name: Checkout repository |
51 | 53 | uses: actions/checkout@v4 |
52 | 54 |
|
|
61 | 63 | secret:CPLN_TOKEN_STAGING |
62 | 64 | variable:CPLN_ORG_STAGING |
63 | 65 | variable:REVIEW_APP_PREFIX |
| 66 | + pull_request_friendly: "true" |
64 | 67 |
|
65 | 68 | - name: Setup environment |
66 | 69 | uses: ./.github/actions/cpflow-setup-environment |
@@ -101,6 +104,33 @@ jobs: |
101 | 104 | cpln_org: ${{ vars.CPLN_ORG_STAGING }} |
102 | 105 | review_app_prefix: ${{ vars.REVIEW_APP_PREFIX }} |
103 | 106 |
|
| 107 | + - name: Mark GitHub deployment inactive |
| 108 | + uses: actions/github-script@v7 |
| 109 | + with: |
| 110 | + script: | |
| 111 | + const environment = `review/${process.env.APP_NAME}`; |
| 112 | + const deployments = await github.paginate(github.rest.repos.listDeployments, { |
| 113 | + owner: context.repo.owner, |
| 114 | + repo: context.repo.repo, |
| 115 | + environment, |
| 116 | + per_page: 100 |
| 117 | + }); |
| 118 | +
|
| 119 | + if (deployments.length === 0) { |
| 120 | + core.info(`No GitHub deployments found for ${environment}.`); |
| 121 | + return; |
| 122 | + } |
| 123 | +
|
| 124 | + for (const deployment of deployments) { |
| 125 | + await github.rest.repos.createDeploymentStatus({ |
| 126 | + owner: context.repo.owner, |
| 127 | + repo: context.repo.repo, |
| 128 | + deployment_id: deployment.id, |
| 129 | + state: "inactive", |
| 130 | + description: `Review app ${process.env.APP_NAME} was deleted` |
| 131 | + }); |
| 132 | + } |
| 133 | +
|
104 | 134 | - name: Finalize delete status |
105 | 135 | if: always() |
106 | 136 | uses: actions/github-script@v7 |
|
0 commit comments