Skip to content

fix(screenshots.json): adjust geometry values for better screenshot positioning The geometry values in the screenshots.json file have been adjusted to ensure the screenshot captures the intended area of the screen. This change improves the accuracy of the screenshots taken for documentation or presentation purposes. #161

fix(screenshots.json): adjust geometry values for better screenshot positioning The geometry values in the screenshots.json file have been adjusted to ensure the screenshot captures the intended area of the screen. This change improves the accuracy of the screenshots taken for documentation or presentation purposes.

fix(screenshots.json): adjust geometry values for better screenshot positioning The geometry values in the screenshots.json file have been adjusted to ensure the screenshot captures the intended area of the screen. This change improves the accuracy of the screenshots taken for documentation or presentation purposes. #161

Workflow file for this run

---
name: screenshots
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- main
paths:
- ".github/workflows/screenshots.yml"
- "screenshots.json"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions:
id-token: write
contents: write
pull-requests: write
actions: write
jobs:
configure:
if: ${{ ! contains('
release-please
dependabot
', github.head_ref)
}}
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Set matrix data
id: set-matrix
run: echo "matrix=$(jq -c . < ./screenshots.json)" >> $GITHUB_OUTPUT
screenshots:
name: screenshots
if: ${{ ! contains('
release-please
dependabot
', github.head_ref)
}}
needs: configure
strategy:
fail-fast: false
max-parallel: 1
matrix: ${{ fromJson(needs.configure.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- uses: browser-actions/setup-chrome@52f10de5479c69bcbbab2eab094c9d373148005e
if: ${{ matrix.url != '' }}
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65
if: ${{ matrix.url != '' }}
- name: Install dependencies
if: ${{ matrix.url != '' }}
run: |
npm i puppeteer
- name: take-screenshot
if: ${{ matrix.url != '' }}
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3
with:
run: |
node puppeteer.js ${{ matrix.url }} ./docs/img/screenshots/${{ matrix.filename }}
- name: overlay-arrow
run: |
composite -geometry ${{ matrix.geometry }} docs/img/overlays/pointer-${{ matrix.pointerangle }}.png docs/img/screenshots/${{ matrix.filename }} docs/img/${{ matrix.filename }}
- name: rounded-corners
run: |
size=$(identify -format "%[fx:w]x%[fx:h]" "docs/img/${{ matrix.filename }}")
width=$(echo $size | cut -d'x' -f1)
height=$(echo $size | cut -d'x' -f2)
convert -size $size xc:none -draw "roundrectangle 0,0,$width,$height,10,10" png:- | convert docs/img/${{ matrix.filename }} -matte - -compose DstIn -composite output.png
mv output.png docs/img/${{ matrix.filename }}
- name: add-border
run: |
convert docs/img/${{ matrix.filename }} \
-bordercolor none -border 20 \
\( -clone 0 -fill black -colorize 100 \) \
\( -clone 0 -alpha extract -write mpr:alpha -morphology edgeout disk:1 \) \
-alpha off -compose over -composite \
\( mpr:alpha -morphology dilate disk:1 \) \
-alpha off -compose copy_opacity -composite \
output.png
mv output.png docs/img/${{ matrix.filename }}
- name: drop-shadow
run: |
convert docs/img/${{ matrix.filename }} \( +clone -background black -shadow 30x35+0+18 \) \
+swap \
-background none \
-layers merge \
+repage \
output.png
convert output.png -bordercolor none -border 18 output2.png
mv output2.png docs/img/${{ matrix.filename }}
rm output.png
- name: Push changes
env:
BRANCH: ${{github.event.pull_request.head.ref}}
run: |
git config user.name "$(git log -n 1 --pretty=format:%an)"
git config user.email "$(git log -n 1 --pretty=format:%ae)"
git add .
git commit -m "docs(${{ matrix.filename }}): processing screenshot"
git config pull.rebase false
git pull
git push --force-with-lease