This repository was archived by the owner on Mar 16, 2026. It is now read-only.
VNC Screenshot Bot #2363
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: VNC Screenshot Bot | |
| on: | |
| schedule: | |
| - cron: '*/30 * * * *' | |
| workflow_dispatch: | |
| jobs: | |
| screenshot: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # 必须获取完整历史 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: "temurin" | |
| java-version: "25" | |
| - name: BFG | |
| run: | | |
| curl -o /tmp/bfg.jar https://repo1.maven.org/maven2/com/madgag/bfg/1.15.0/bfg-1.15.0.jar | |
| java -jar /tmp/bfg.jar . --delete-files "*.{png,jpg,jpeg}" || exit 0 | |
| git reflog expire --expire=now --all || exit 0 | |
| git gc --prune=now || exit 0 | |
| - name: Install VNC client and Python | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-pip | |
| pip3 install vncdotool | |
| - name: Take Screenshot for G12 | |
| continue-on-error: true | |
| env: | |
| VNC_PASSWORD: ${{ secrets.G12_VNC_PASSWORD }} | |
| VNC_SERVER: ${{ secrets.G12_VNC_SERVER }} | |
| run: | | |
| vncdotool -s "$VNC_SERVER" -p "$VNC_PASSWORD" capture g12_screenshot.png | |
| - name: Commit and Push | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| if [ -f g12_screenshot.png ]; then | |
| git add g12_screenshot.png | |
| else | |
| git rm --cached g12_screenshot.png --ignore-unmatch | |
| fi | |
| git commit -m "Update VNC screenshot: $(date)" || exit 0 | |
| git push --force |