Skip to content

fix: issue 478 update storybook link #496

fix: issue 478 update storybook link

fix: issue 478 update storybook link #496

Workflow file for this run

name: Publish canary on PR comment
on:
issue_comment:
types:
- created
jobs:
check_auth:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/canary' }}
steps:
- name: Check auth
id: check_auth
uses: actions/github-script@v6
with:
result-encoding: string
github-token: ${{ secrets.GH_TOKEN }}
script: |
const { owner, repo } = context.issue;
const { login: username } = context.payload.comment.user;
await github.rest.repos.checkCollaborator({
owner,
repo,
username,
});
github.rest.reactions.createForIssueComment({
owner,
repo,
comment_id: context.payload.comment.id,
content: "eyes",
});
const { number: pull_number } = context.payload.issue;
const { data: { head: { ref: branch }}} = await github.rest.pulls.get({
owner,
repo,
pull_number,
});
return branch;
- name: Not a collaborator
if: ${{ failure() }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const { owner, repo, number: issue_number } = context.issue;
github.rest.reactions.createForIssueComment({
owner,
repo,
comment_id: context.payload.comment.id,
content: "-1",
});
github.rest.issues.createComment({
owner,
repo,
issue_number,
body: 'Canary builds can only be requested by collaborators. Please tag a maintainer to request a canary build. ❌',
});
outputs:
branch: ${{ steps.check_auth.outputs.result }}
trigger_canary:
runs-on: ubuntu-latest
needs: check_auth
steps:
- name: Trigger canary build
run: |
curl --no-progress-meter --fail --request POST \
--url https://circleci.com/api/v2/project/gh/${{ github.repository }}/pipeline \
--header 'Circle-Token: ${{ secrets.CCI_TOKEN }}' \
--header 'content-type: application/json' \
--header 'x-attribution-login: ${{ github.actor }}' \
--header 'x-attribution-actor-id: ${{ github.actor }}' \
--data '{ "branch": "${{ needs.check_auth.outputs.branch }}", "parameters": { "should_release": true }}'
- name: Trigger success
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const { owner, repo } = context.issue;
github.rest.reactions.createForIssueComment({
owner,
repo,
comment_id: context.payload.comment.id,
content: "rocket",
});
- name: Trigger failed
if: ${{ failure() }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const { owner, repo } = context.issue;
github.rest.reactions.createForIssueComment({
owner,
repo,
comment_id: context.payload.comment.id,
content: "confused",
});