name: format-userscripts on: # schedule: # - cron: "0 2 * * 2" # 每周二的 UTC 时间 2 点,即北京时间的早上 10 点 workflow_dispatch: # 允许手动触发工作流 jobs: format-js: runs-on: ubuntu-latest steps: # Step 1: Checkout the repository from bak branch - name: Checkout repository uses: actions/checkout@v3 with: token: ${{ secrets.MY_GITHUB_TOKEN }} # Step 2: Set up Node.js environment - name: Set up Node.js uses: actions/setup-node@v3 with: node-version: "16" # 可以根据需要调整 # Step 3: Run the custom formatting script (1.js) - name: Run format script run: node utils/format-monkey-meta.js # Step 4: Commit and push changes back to the bak branch (if any) - name: Commit and push changes # 在推送时使用 GitHub Token run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" git add . git commit -m "Auto-format UserScripts" || echo "No changes to commit" git push env: MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}