Skip to content

[#171] Add auth context #1

[#171] Add auth context

[#171] Add auth context #1

Workflow file for this run

name: Comment the storybook preview url

Check failure on line 1 in .github/workflows/ui-comment.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/ui-comment.yaml

Invalid workflow file

`jobs` is not a valid event name
on:
workflow_run:
workflows: ['UI Test']
types:
- completed
jobs:
upload:
runs-on: ubuntu-22.04
if: >
github.event.workflow_run.event == 'pull_request'
steps:
- name: 'Download artifact'
uses: actions/[email protected]
with:
script: |
const artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow._run.id }},
});
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
const download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const fs = require('fs');
fs.writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data))
- run: unzip pr.zip
- name: Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const url = fs.readFileSync('./URL');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🚀 Storybook preview: [${url}](${url})`
});