Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow specification of app inside snap to screenshot #32

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions get-screenshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
| `github-token` | A token with permissions to common on issues in the repository. | Y | |
| `screenshots-repo` | The repository where screenshots should be uploaded. | N | `snapcrafters/ci-screenshots` |
| `screenshots-token` | A token with permissions to commit screenshots to [ci-screenshots](https://github.com/snapcrafters/ci-screenshots) | Y | |
| `snap-application-name` | The name of the application defined in `snapcraft.yaml` to run for screenshots. | N | |
| `snapcraft-project-root` | The root of the snapcraft project, where the `snapcraft` command would usually be executed from. Do not include the trailing `/`. | N |

### Outputs
Expand Down
11 changes: 10 additions & 1 deletion get-screenshots/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ inputs:
github-token:
description: "A token with permissions to comment on issues"
required: true
snap-application-name:
description: "The name of the application defined in `snapcraft.yaml` to run for screenshots."
required: false
snapcraft-project-root:
description: "The root of the snapcraft project, where the `snapcraft` command would usually be executed from."
required: false
Expand Down Expand Up @@ -63,6 +66,7 @@ runs:
shell: bash
env:
snap_name: ${{ steps.snapcraft-yaml.outputs.snap-name }}
snap_app: ${{ inputs.snap-application-name }}
run: |
ghvmctl prepare

Expand All @@ -76,7 +80,12 @@ runs:
ghvmctl snap-install "${snap_name}" --channel "${{ inputs.channel }}"
fi

ghvmctl snap-run "${snap_name}"
# If the snap-application-name is empty, default to the name of the snap
if [[ -z "$snap_app" ]]; then
snap_app="$snap_name"
fi

ghvmctl snap-run "${snap_name}.${snap_app}"
sleep 60

- name: Gather screenshots
Expand Down