Skip to content

Migrate space custom properties from v11 to v12 #3835

Migrate space custom properties from v11 to v12

Migrate space custom properties from v11 to v12 #3835

name: Trigger deploy of polaris-staging.shopifycloud.com
on:
issue_comment:
types:
- created
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
trigger-deploy:
name: Deploy to staging
if: |
github.event.issue.pull_request && github.event.comment.body == '/stageit'
runs-on: ubuntu-latest
steps:
- name: Enforce permission requirement
uses: prince-chrismc/check-actor-permissions-action@v1
with:
permission: write
- name: Validate pull request and get PR SHA
uses: actions/github-script@v6
id: sha
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
result-encoding: string
script: |
try {
const pullRequest = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
})
// Pull request from fork
if (context.payload.repository.full_name !== pullRequest.data.head.repo.full_name) {
const errorMessage = '`/stageit` is not supported on pull requests from forked repositories.'
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: errorMessage,
})
core.setFailed(errorMessage)
} else {
return pullRequest.data.head.sha
}
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- name: Trigger deploy polaris-staging.shopifycloud.com
uses: actions/github-script@v6
with:
github-token: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: "shopify",
repo: "polaris-site-container-builder",
workflow_id: "trigger-deploy.yml",
ref: "staging-bdvt",
inputs: {
sha: "${{steps.sha.outputs.result}}",
target: 'staging',
}
});
- name: Create comment
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `\`🚀 ${{steps.sha.outputs.result}}\` is now deploying to staging. [View status](https://shipit.shopify.io/shopify/polaris-site-container-builder/staging-bdvt/tasks).`,
});