-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
38 lines (28 loc) · 1.37 KB
/
entrypoint.sh
File metadata and controls
38 lines (28 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -e
if [ -z "${GITHUB_TOKEN}" ]; then
echo "GITHUB_TOKEN environment variable is not set."
exit 1
fi
if [ -z "${INPUT_URL}" ]; then
echo "INPUT_URL environment variable is not set."
exit 1
fi
# Add an exception for the /github/workspace directory in the Git configuration
git config --global --add safe.directory /github/workspace
# Run the CLI tool to take a screenshot and save it
snapsht click "${INPUT_URL}"
# Install the GitHub CLI (gh)
apt-get update && apt-get install -y curl && apt-get clean
curl -sSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee -a /etc/apt/sources.list.d/github-cli.list
apt-get update && apt-get install -y gh
# Authenticate with the GitHub CLI
#echo "${GITHUB_TOKEN}" | gh auth login --with-token
# Get the pull request number from the GitHub Actions event payload
PR_NUMBER=$(jq -r '.number' "$GITHUB_EVENT_PATH")
# Post the screenshot on the PR
gh pr comment "$PR_NUMBER" --body ")"
# Post the screenshot as a comment on the PR
#pr_comment=")"
#gh pr comment "$(echo $PR_URL)" --body "$pr_comment"