From e2d97a3dca2f02b2ab217e29cbd5f856d9a128bf Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Mon, 15 Sep 2025 19:22:56 +0200 Subject: [PATCH] chore: Replace Makefile with atmos.yaml --- .github/workflows/test.yaml | 91 +++++++++++++++++++------------------ Makefile | 18 -------- atmos.yaml | 2 + docs/github-action.md | 28 ------------ 4 files changed, 48 insertions(+), 91 deletions(-) delete mode 100644 Makefile create mode 100644 atmos.yaml delete mode 100644 docs/github-action.md diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a638273..6d85999 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,60 +1,61 @@ name: Test - on: pull_request: types: [opened, synchronize, reopened] - + workflow_dispatch: + inputs: + ref: + description: The fully-formed ref of the branch or tag that triggered the workflow run + required: false + type: string + sha: + description: The sha of the commit that triggered the workflow run + required: false + type: string jobs: screenshot: runs-on: ubuntu-latest concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true - permissions: # Give the default GITHUB_TOKEN write permission to commit and push the # added or changed files to the repository. contents: write - steps: - - uses: actions/checkout@v4 - - - name: Run this composite action - id: screenshot - uses: ./ # Use the path to your action directory - with: - # Your action's inputs - url: "file://${{github.workspace}}/test/html/index.html" - output: "docs/example.png" - css: | - body { - background: rgb(2,0,36); - background: linear-gradient(139deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 56%, rgba(147,0,255,1) 100%); - } - customizations: | - "#name": "${{ github.event.repository.name }} 📷" - viewportWidth: 2000 - viewportHeight: 800 - - - uses: stefanzweifel/git-auto-commit-action@v5 - name: Commit artifact - id: auto-commit - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - commit_message: "chore: update example image" - commit_user_name: screenshot-action 📷 - commit_user_email: actions@github.com - commit_author: screenshot-action 📷 - file_pattern: 'docs/*.png' - - - name: Add Image to Step Summary - if: steps.auto-commit.outputs.changes_detected == 'true' - run: | - echo "## Generated Screenshot" >> $GITHUB_STEP_SUMMARY - echo "![Generated Screenshot](https://github.com/${{ github.repository }}/blob/${{ steps.auto-commit.outputs.commit_hash }}/${{ steps.screenshot.outputs.file }}?raw=true)" >> $GITHUB_STEP_SUMMARY - - - name: No changes - if: steps.auto-commit.outputs.changes_detected == 'false' - run: | - echo "No changes to screenshot" >> $GITHUB_STEP_SUMMARY + - uses: actions/checkout@v4 + - name: Run this composite action + id: screenshot + uses: ./ # Use the path to your action directory + with: + # Your action's inputs + url: "file://${{github.workspace}}/test/html/index.html" + output: "docs/example.png" + css: | + body { + background: rgb(2,0,36); + background: linear-gradient(139deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 56%, rgba(147,0,255,1) 100%); + } + customizations: "\"#name\": \"${{ github.event.repository.name }} \U0001F4F7\"\n" + viewportWidth: 2000 + viewportHeight: 800 + - uses: stefanzweifel/git-auto-commit-action@v5 + name: Commit artifact + id: auto-commit + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + commit_message: "chore: update example image" + commit_user_name: "screenshot-action \U0001F4F7" + commit_user_email: actions@github.com + commit_author: "screenshot-action \U0001F4F7 " + file_pattern: 'docs/*.png' + - name: Add Image to Step Summary + if: steps.auto-commit.outputs.changes_detected == 'true' + run: | + echo "## Generated Screenshot" >> $GITHUB_STEP_SUMMARY + echo "![Generated Screenshot](https://github.com/${{ github.repository }}/blob/${{ steps.auto-commit.outputs.commit_hash }}/${{ steps.screenshot.outputs.file }}?raw=true)" >> $GITHUB_STEP_SUMMARY + - name: No changes + if: steps.auto-commit.outputs.changes_detected == 'false' + run: | + echo "No changes to screenshot" >> $GITHUB_STEP_SUMMARY diff --git a/Makefile b/Makefile deleted file mode 100644 index 643e0e9..0000000 --- a/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -SHELL := /bin/bash - -# List of targets the `readme` target should call before generating the readme -export README_DEPS ?= docs/github-action.md - -export GITHUB_WORKSPACE ?= $(PWD) - --include $(shell curl -sSL -o .build-harness "https://cloudposse.tools/build-harness"; echo .build-harness) - -deps: - npm install - -run: - node main.js - -# This will not work on a Mac -docker/run: - docker run -i --init --cap-add=SYS_ADMIN -v $(PWD):$(PWD) --workdir=$(PWD) ghcr.io/puppeteer/puppeteer:21.3.8 bash -c 'npm install --no-fund option && node main.js' diff --git a/atmos.yaml b/atmos.yaml new file mode 100644 index 0000000..dfa6aca --- /dev/null +++ b/atmos.yaml @@ -0,0 +1,2 @@ +import: + - https://raw.githubusercontent.com/cloudposse/.github/refs/heads/main/.github/atmos/github-action.yaml diff --git a/docs/github-action.md b/docs/github-action.md deleted file mode 100644 index 0d4a366..0000000 --- a/docs/github-action.md +++ /dev/null @@ -1,28 +0,0 @@ - - -## Inputs - -| Name | Description | Default | Required | -|------|-------------|---------|----------| -| consoleOutputEnabled | Whether or not to output the browser console log | true | false | -| css | Custom CSS overrides | N/A | false | -| customizations | String representation of a YAML or JSON map of CSS paths (key) and replacement (value) | N/A | false | -| deviceScaleFactor | Specifies the device scale factor (pixel ratio) for the web page rendering. It determines how many physical pixels are used to represent a single logical pixel. For example, a device scale factor of 2 means one logical pixel is represented by two physical pixels, commonly used for high-DPI (Retina) displays. A value of 1 uses standard pixel density. This factor affects the resolution and quality of the rendered page or screenshot. | 2 | false | -| fullPage | Screen capture the entire page by scrolling down | false | false | -| imageQuality | Quality of the output image (1-100, applicable for JPEG) | N/A | false | -| omitBackground | Omit the browser default background. Enable to support transparency. | true | false | -| output | Output image file path | screenshot.png | false | -| outputType | Output image type | png | false | -| puppeteerImage | Docker image to run puppeteer. See https://github.com/puppeteer/puppeteer/pkgs/container/puppeteer | ghcr.io/puppeteer/puppeteer:22.13.1 | false | -| url | URL of the HTML content to convert to an image. Use file:// for local files | N/A | true | -| viewportHeight | Viewport height in pixels | N/A | true | -| viewportWidth | Viewport width in pixels | N/A | true | -| waitForTimeout | Number of milliseconds to delay before taking screenshot | 500 | false | - - -## Outputs - -| Name | Description | -|------|-------------| -| file | File containing the generated screenshot | -