Skip to content

Dashboard: allow pinch-to-zoom by dropping maximum-scale on dashboard sections #41163

Dashboard: allow pinch-to-zoom by dropping maximum-scale on dashboard sections

Dashboard: allow pinch-to-zoom by dropping maximum-scale on dashboard sections #41163

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 homeLink = `https://calypso.live/home?${{steps.build_link.outputs.QUERY}}`;
const groups = [
{
label: 'WordPress.com',
environments: [
{ label: 'Dashboard Live', url: `${link}&env=dashboard` },
{ label: 'Calypso Live (/home)', url: homeLink },
],
},
{
label: 'Automattic for Agencies',
environments: [
{ label: 'Dashboard Live', url: `${link}&env=dashboard-a4a` },
{ label: 'Automattic for Agencies Live', url: `${link}&env=a8c-for-agencies` },
],
},
{
label: 'Jetpack Cloud',
environments: [
{ label: 'Jetpack Cloud Live', url: `${link}&env=jetpack` },
],
},
];
const renderEnv = ( env ) => trimIndent(`
<details>
<summary>${env.label} <a href="${env.url}">(direct link)</a></summary>
<table>
<tr>
<td>
<a href="${env.url}">${env.url}</a>
</td>
</tr>
</table>
</details>`
);
// A group holding a single environment renders as a bare item, without a heading.
const renderGroup = ( group ) =>
group.environments.length === 1
? renderEnv( group.environments[ 0 ] )
: [
`<p>${ group.label }</p>`,
'<ul>',
...group.environments.map( env => `<li>\n${ renderEnv( env ) }\n</li>` ),
'</ul>',
].join( '\n' );
const body = [
'<!--calypso-live-watermark:apr@v1-->',
groups.map( renderGroup ).join( '\n<hr>\n' ),
].join( '\n' );
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
})