Skip to content

Commit

Permalink
try new approach for screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
sverrejb committed Mar 13, 2024
1 parent d184e55 commit 9884b78
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/take_screenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,21 @@ jobs:
cargo run --release > cargo.log 2>&1 &
sleep 10
cat cargo.log
osascript -e 'tell application "System Events" to tell process "infoskjerm" to set frontmost to true'
osascript -e 'delay 10'
WINDOW_ID=$(osascript -e 'tell application "System Events" to return id of window of process "infoskjerm"')
echo "Window ID: $WINDOW_ID" # Print the window ID
screencapture -l$WINDOW_ID screenshot.png
window_info=$(osascript -e 'tell application "System Events" to tell process "infoskjerm" to get {position, size} of window 1')
x=$(echo $window_info | cut -d, -f1)
y=$(echo $window_info | cut -d, -f2)
w=$(echo $window_info | cut -d, -f3)
h=$(echo $window_info | cut -d, -f4)
rectangle="${x},${y},${w},${h}"
rectangle=$(echo $rectangle | tr -d ' ')
screencapture -R$rectangle screenshot.png
- name: Commit and push screenshot
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Add screenshot" -a
git add screenshot.png
git commit -m "Add updated screenshot" -a
git push

0 comments on commit 9884b78

Please sign in to comment.