diff --git a/.github/workflows/guides-e2e-screenshots.yml b/.github/workflows/guides-e2e-screenshots.yml new file mode 100644 index 00000000..e9f056ca --- /dev/null +++ b/.github/workflows/guides-e2e-screenshots.yml @@ -0,0 +1,29 @@ +# TEMPORARY: end-to-end check for the draft /guides Actions guide (PR #1024). +# Mirrors the guide's workflow. Delete this branch after the run. +on: pull_request + +permissions: + contents: read + pull-requests: write + +jobs: + screenshots: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Write a test screenshot + run: | + mkdir -p shots + python3 -c " + import zlib, struct + w, h = 800, 400 + raw = b''.join(b'\x00' + bytes([31, 41, 55]) * w for _ in range(h)) + def chunk(t, d): return struct.pack('>I', len(d)) + t + d + struct.pack('>I', zlib.crc32(t + d)) + png = b'\x89PNG\r\n\x1a\n' + chunk(b'IHDR', struct.pack('>IIBBBBB', w, h, 8, 2, 0, 0, 0)) + chunk(b'IDAT', zlib.compress(raw)) + chunk(b'IEND', b'') + open('shots/ci-e2e.png', 'wb').write(png) + " + - run: npm install -g @buildinternet/uploads + - run: uploads put ./shots/*.png --pr ${{ github.event.pull_request.number }} + env: + UPLOADS_TOKEN: ${{ secrets.UPLOADS_TOKEN }} + GH_TOKEN: ${{ github.token }}