main #106
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: main | |
| on: | |
| workflow_dispatch: | |
| # push: | |
| schedule: | |
| - cron: 1 16 * * * | |
| jobs: | |
| run: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 检出仓库 | |
| uses: actions/checkout@v6 | |
| - name: 创建node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: 'npm' | |
| cache-dependency-path: ./api/package-lock.json | |
| - name: 🔧 安装GitHub CLI,并使用PAT登录 | |
| env: | |
| PAT: ${{ secrets.PAT }} | |
| run: | | |
| if [ -n "${PAT}" ]; then | |
| curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | |
| sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg | |
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | |
| sudo apt update | |
| sudo apt install gh -y | |
| gh --version | |
| echo "${{ secrets.PAT }}" | gh auth login --with-token | |
| gh auth status | |
| fi | |
| - name: Cache node_modules in api directory | |
| id: cache-npm | |
| uses: actions/cache@v5 | |
| with: | |
| path: ./api/node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('./api/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: 安装依赖 | |
| run: npm run install | |
| if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
| - name: 签到 | |
| run: npm run main | |
| env: | |
| USERINFO: ${{ secrets.USERINFO }} | |
| PAT: ${{ secrets.PAT }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} |