|
1 | 1 | name: Test |
2 | | - |
3 | 2 | on: |
4 | 3 | pull_request: |
5 | 4 | types: [opened, synchronize, reopened] |
6 | | - |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + ref: |
| 8 | + description: The fully-formed ref of the branch or tag that triggered the workflow run |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + sha: |
| 12 | + description: The sha of the commit that triggered the workflow run |
| 13 | + required: false |
| 14 | + type: string |
7 | 15 | jobs: |
8 | 16 | screenshot: |
9 | 17 | runs-on: ubuntu-latest |
10 | 18 | concurrency: |
11 | 19 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
12 | 20 | cancel-in-progress: true |
13 | | - |
14 | 21 | permissions: |
15 | 22 | # Give the default GITHUB_TOKEN write permission to commit and push the |
16 | 23 | # added or changed files to the repository. |
17 | 24 | contents: write |
18 | | - |
19 | 25 | steps: |
20 | | - - uses: actions/checkout@v4 |
21 | | - |
22 | | - - name: Run this composite action |
23 | | - id: screenshot |
24 | | - uses: ./ # Use the path to your action directory |
25 | | - with: |
26 | | - # Your action's inputs |
27 | | - url: "file://${{github.workspace}}/test/html/index.html" |
28 | | - output: "docs/example.png" |
29 | | - css: | |
30 | | - body { |
31 | | - background: rgb(2,0,36); |
32 | | - background: linear-gradient(139deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 56%, rgba(147,0,255,1) 100%); |
33 | | - } |
34 | | - customizations: | |
35 | | - "#name": "${{ github.event.repository.name }} 📷" |
36 | | - viewportWidth: 2000 |
37 | | - viewportHeight: 800 |
38 | | - |
39 | | - - uses: stefanzweifel/git-auto-commit-action@v5 |
40 | | - name: Commit artifact |
41 | | - id: auto-commit |
42 | | - env: |
43 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
44 | | - with: |
45 | | - commit_message: "chore: update example image" |
46 | | - commit_user_name: screenshot-action 📷 |
47 | | - commit_user_email: [email protected] |
48 | | - commit_author: screenshot-action 📷 <[email protected]> |
49 | | - file_pattern: 'docs/*.png' |
50 | | - |
51 | | - - name: Add Image to Step Summary |
52 | | - if: steps.auto-commit.outputs.changes_detected == 'true' |
53 | | - run: | |
54 | | - echo "## Generated Screenshot" >> $GITHUB_STEP_SUMMARY |
55 | | - echo "" >> $GITHUB_STEP_SUMMARY |
56 | | -
|
57 | | - - name: No changes |
58 | | - if: steps.auto-commit.outputs.changes_detected == 'false' |
59 | | - run: | |
60 | | - echo "No changes to screenshot" >> $GITHUB_STEP_SUMMARY |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - name: Run this composite action |
| 28 | + id: screenshot |
| 29 | + uses: ./ # Use the path to your action directory |
| 30 | + with: |
| 31 | + # Your action's inputs |
| 32 | + url: "file://${{github.workspace}}/test/html/index.html" |
| 33 | + output: "docs/example.png" |
| 34 | + css: | |
| 35 | + body { |
| 36 | + background: rgb(2,0,36); |
| 37 | + background: linear-gradient(139deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 56%, rgba(147,0,255,1) 100%); |
| 38 | + } |
| 39 | + customizations: "\"#name\": \"${{ github.event.repository.name }} \U0001F4F7\"\n" |
| 40 | + viewportWidth: 2000 |
| 41 | + viewportHeight: 800 |
| 42 | + - uses: stefanzweifel/git-auto-commit-action@v5 |
| 43 | + name: Commit artifact |
| 44 | + id: auto-commit |
| 45 | + env: |
| 46 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + with: |
| 48 | + commit_message: "chore: update example image" |
| 49 | + commit_user_name: "screenshot-action \U0001F4F7" |
| 50 | + commit_user_email: [email protected] |
| 51 | + commit_author: "screenshot-action \U0001F4F7 <[email protected]>" |
| 52 | + file_pattern: 'docs/*.png' |
| 53 | + - name: Add Image to Step Summary |
| 54 | + if: steps.auto-commit.outputs.changes_detected == 'true' |
| 55 | + run: | |
| 56 | + echo "## Generated Screenshot" >> $GITHUB_STEP_SUMMARY |
| 57 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 58 | + - name: No changes |
| 59 | + if: steps.auto-commit.outputs.changes_detected == 'false' |
| 60 | + run: | |
| 61 | + echo "No changes to screenshot" >> $GITHUB_STEP_SUMMARY |
0 commit comments