Skip to content

Dashboard: silence benign "Transition was skipped" rejection #40315

Dashboard: silence benign "Transition was skipped" rejection

Dashboard: silence benign "Transition was skipped" rejection #40315

Workflow file for this run

name: Calypso Live
on:
pull_request:
types: ['opened']
jobs:
calypso-live:
name: 'Links to a calypso.live instance for your branch'
runs-on: ubuntu-latest
# We only offer the Calypso.live link to PRs created from the Automattic organization.
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
timeout-minutes: 10
steps:
- name: Check if comment exists
id: has_comment
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const comments = await github.rest.issues.listComments( {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
} );
// For debugging, if needed!
console.log( comments );
const existingComment = comments.data.find( comment => comment.body.includes( "calypso-live-watermark:apr@v1" ) );
const hasComment = existingComment ? "true" : "false";
console.log( `Has existing comment: ${ hasComment }` );
return hasComment;
- name: Build calypso.live link
run: |
echo "QUERY=image=registry.a8c.com/calypso/app:commit-${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
id: build_link
- name: Post comment on PR
uses: actions/github-script@v6
if: steps.has_comment.outputs.result == 'false'
with:
# Skip adding a comment if we already have one.
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
function trimIndent(str) {
const lines = str.replace(/^\n+|\n+$/g, '').split('\n');
const min = Math.min(...lines.filter(l => l.trim()).map(l => l.match(/^ */)[0].length));
return lines.map(l => l.slice(min)).join('\n');
}
const link = `https://calypso.live?${{steps.build_link.outputs.QUERY}}`;
const body = trimIndent(`
<!--calypso-live-watermark:apr@v1-->
<details>
<summary>
Calypso Live <a href="${link}">(direct link)</a>
</summary>
<table>
<tr>
<td>
<a href="${link}">${link}</a>
</td>
</tr>
</table>
</details>
<details>
<summary>
Jetpack Cloud Live <a href="${link}&env=jetpack">(direct link)</a>
</summary>
<table>
<tr>
<td>
<a href="${link}&env=jetpack">${link}&env=jetpack</a>
</td>
</tr>
</table>
</details>
<details>
<summary>
Automattic for Agencies Live <a href="${link}&env=a8c-for-agencies">(direct link)</a>
</summary>
<table>
<tr>
<td>
<a href="${link}&env=a8c-for-agencies">${link}&env=a8c-for-agencies</a>
</td>
</tr>
</table>
</details>
<details>
<summary>
Dashboard Live (dotcom) <a href="${link}&env=dashboard">(direct link)</a>
</summary>
<table>
<tr>
<td>
<a href="${link}&env=dashboard">${link}&env=dashboard</a>
</td>
</tr>
</table>
</details>
<details>
<summary>
Dashboard Live (A4A) <a href="${link}&env=dashboard-a4a">(direct link)</a>
</summary>
<table>
<tr>
<td>
<a href="${link}&env=dashboard-a4a">${link}&env=dashboard-a4a</a>
</td>
</tr>
</table>
</details>`
);
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
})