init commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
name: Daily check in
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 22 * * *" # scheduled at 06:00 (UTC+8) everyday
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check-in:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Check In
|
||||
run: node index.js
|
||||
env:
|
||||
COOKIE: ${{ secrets.COOKIE }}
|
||||
GAMES: ${{ vars.GAMES }}
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
DISCORD_USER: ${{ secrets.DISCORD_USER }}
|
||||
workflow-keepalive:
|
||||
if: github.event_name == 'schedule'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
steps:
|
||||
- uses: liskin/gh-workflow-keepalive@v1
|
||||
@@ -0,0 +1,46 @@
|
||||
name: Latest version
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 18 * * *" # scheduled at 06:00 (UTC+8) everyday
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Fetch package.json from original repo
|
||||
run: |
|
||||
curl -o remote-package.json \
|
||||
https://raw.githubusercontent.com/sglkc/hoyolab-auto-daily/master/package.json
|
||||
|
||||
- name: Compare versions
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
run: |
|
||||
LOCAL_VERSION=$(jq -r .version package.json)
|
||||
REMOTE_VERSION=$(jq -r .version remote-package.json)
|
||||
echo "Local version: $LOCAL_VERSION"
|
||||
echo "Remote version: $REMOTE_VERSION"
|
||||
|
||||
if [ "$(printf '%s\n' "$REMOTE_VERSION" "$LOCAL_VERSION" | sort -V | head -n1)" != "$REMOTE_VERSION" ]; then
|
||||
echo "Repository version is outdated. Do sync your fork!"
|
||||
|
||||
if [ ! -z "$DISCORD_WEBHOOK" ]; then
|
||||
curl -H "Content-Type: application/json" \
|
||||
-d '{"content": "(INFO) New version released. Your repository is outdated."}' \
|
||||
$DISCORD_WEBHOOK
|
||||
fi
|
||||
|
||||
exit 1
|
||||
fi
|
||||
workflow-keepalive:
|
||||
if: github.event_name == 'schedule'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
steps:
|
||||
- uses: liskin/gh-workflow-keepalive@v1
|
||||
Reference in New Issue
Block a user