introduce new visual regression tests with chromatic instead of storybook #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Image Comment | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| jobs: | |
| generate-image: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install ImageMagick | |
| run: sudo apt-get update && sudo apt-get install -y imagemagick | |
| - name: Generate an image (example) | |
| run: | | |
| convert -size 100x100 xc:blue image.png # Example: create a 100x100 blue image | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pr-image | |
| path: image.png | |
| comment-with-image: | |
| needs: generate-image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pr-image | |
| path: . | |
| - name: Upload image to GitHub Issue | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| UPLOAD_RESPONSE=$(gh api \ | |
| --method POST \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| -F "file=@image.png" \ | |
| /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments 2>&1) || true | |
| echo "Upload response: $UPLOAD_RESPONSE" | |
| IMG_URL=$(echo "$UPLOAD_RESPONSE" | jq -r '.url' 2>/dev/null || echo "") | |
| if [[ -z "$IMG_URL" ]]; then | |
| echo "Failed to extract image URL." | |
| exit 1 | |
| fi | |
| COMMENT_BODY="Here is the generated image: " | |
| echo "Comment body: $COMMENT_BODY" | |
| gh api --method POST /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \ | |
| -f body="$COMMENT_BODY" | |