Skip to content
Closed
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
24 changes: 24 additions & 0 deletions .github/workflows/ping-codespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Ping Codespace Daily

on:
schedule:
- cron: "0 2 * * *"
workflow_dispatch:

jobs:
ping:
runs-on: ubuntu-latest
steps:
- name: Install GitHub CLI
run: sudo apt-get update && sudo apt-get install gh -y

- name: Auth GitHub CLI
run: echo "${{ secrets.GH_TOKEN }}" | gh auth login --with-token

- name: List Codespaces
run: gh codespace list

- name: Ping Codespace
run: |
CODESPACE_NAME="musical-umbrella-694xp6vj96ppfqpj"
gh codespace ssh -c "$CODESPACE_NAME" -d "echo 'Ping at $(date)'"
35 changes: 35 additions & 0 deletions keepalive-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Keep ALL Codespaces Alive via API

on:
schedule:
- cron: "*/15 * * * *" # jalan tiap 15 menit
workflow_dispatch:

jobs:
keepalive:
runs-on: ubuntu-latest
steps:
- name: Ping semua Codespace via API
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
echo "Mengambil semua Codespaces..."
CODESPACES=$(curl -s -H "Authorization: token $GH_TOKEN" \
https://api.github.com/user/codespaces | jq -r '.[].name')

if [ -z "$CODESPACES" ]; then
echo "Tidak ada Codespace ditemukan ❌"
exit 0
fi

for NAME in $CODESPACES; do
echo "Menyalakan Codespace: $NAME..."
curl -s -X POST \
-H "Authorization: token $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/user/codespaces/$NAME/start \
> /dev/null
echo "Codespace $NAME diping ✅"
done

echo "Selesai ping semua Codespace."