Skip to content

Commit

Permalink
ci: 增加Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 committed Aug 7, 2024
1 parent 1f626aa commit cc6917d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/windows_cron_bypassCF.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: bypassCF cron

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

jobs:
build:
runs-on: windows-latest
timeout-minutes: 20

strategy:
matrix:
node-version: [20.x]

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

- name: Load environment variables
id: load-env
run: |
if ($env:USERNAMES -eq $null -or $env:USERNAMES -eq "") {
Write-Host "Loading environment variables from .env file"
Get-Content .env | ForEach-Object {
$name, $value = $_ -split '=', 2
Write-Host "::set-env name=$name::$value"
Write-Host "$name=$value" >> $env:GITHUB_ENV
}
}
else {
Write-Host "Using secrets"
Write-Host "USERNAMES=${{ secrets.USERNAMES_appin }}" >> $env:GITHUB_ENV
Write-Host "PASSWORDS=${{ secrets.PASSWORDS_appin }}" >> $env:GITHUB_ENV
Write-Host "WEBSITE=${{ secrets.WEBSITE_appin }}" >> $env:GITHUB_ENV
}
- name: Run a script
run: node bypasscf.js
2 changes: 1 addition & 1 deletion bypasscf.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async function launchBrowserForUser(username, password) {
page.on("load", async () => {
// await page.evaluate(externalScript); //因为这个是在页面加载好之后执行的,而脚本是在页面加载好时刻来判断是否要执行,由于已经加载好了,脚本就不会起作用
});
// 如果是Linuxdo,就导航到我的帖子
// 如果是Linuxdo,就导航到我的帖子,但我感觉这里写没什么用,因为外部脚本已经定义好了
if (loginUrl == "https://linux.do") {
await page.goto("https://linux.do/t/topic/13716/340", {
waitUntil: "domcontentloaded",
Expand Down

0 comments on commit cc6917d

Please sign in to comment.