Skip to content

readLike(自动阅读随机点赞) #62

readLike(自动阅读随机点赞)

readLike(自动阅读随机点赞) #62

name: bypassCF cron (使用这个)
# GitHub.secrets优先级最高,即使没有设置对应的变量,它也会读取,这时变量为空值,导致报错,.env读取的变量无法覆盖这个值,使用了${PASSWORD_ESCAPED//\#/\\#}来对#转义,需要两个\,但是我直接在env文件使用这种方法是不行的,GitHub action是有效
on:
schedule:
# 每天 UTC 时间 18:00 运行
- cron: "0 18 * * *"
workflow_dispatch: # 允许手动触发
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20 # 设置作业超时时间为20分钟
strategy:
matrix:
node-version: [20.x]
env:
# 在作业级别设置环境变量
USERNAMES: ${{ secrets.USERNAMES }}
PASSWORDS: ${{ secrets.PASSWORDS }}
steps:
- uses: actions/checkout@v3 # 检出仓库
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: |
npm install
sudo apt install -y xvfb
- name: Load environment variables
run: |
echo "Debug: Checking if .env file exists..."
# 检查 .env 文件是否存在
if [ -f .env ]; then
echo ".env file found. Loading environment variables from .env file"
# 加载 .env 文件中的默认值
set -a
source .env
set +a
echo "Loaded .env variables:"
else
echo ".env file not found. Skipping loading."
fi
if [ -n "${{ secrets.WEBSITE }}" ] && [ ! -z "${{ secrets.WEBSITE }}" ]; then
echo "Using GitHub Secret for WEBSITE"
echo "WEBSITE=${{ secrets.WEBSITE }}" >> $GITHUB_ENV
else
echo "WEBSITE=${WEBSITE}" >> $GITHUB_ENV
fi
shell: bash
- name: Run a script
run: node bypasscf.js --USERNAMES "$USERNAMES" --PASSWORDS "$PASSWORDS" --WEBSITE "$WEBSITE"