This workflow will install Python dependencies, run tests and lint with a single version…
- User
This workflow will install Python dependencies, run tests and lint with a single version of Python
For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Pstion1
on: workflow_dispatch: schedule: - cron: '33 18 * * *'
permissions: contents: read
jobs: build:
runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Set up Python 3.10 uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Sdc env: CLUB_USERNAME: ${{ secrets.USERNAME }} CLUB_PASSWORD: ${{ secrets.PASSWORD }} COOKIES: ${{ secrets.COOKIES }} TGBOTAPI: ${{ secrets.TGBOTAPI }} TGID: ${{ secrets.TGID }} run: | python ./as.pyFORCE_JAVASCRIPT_ACTIONS_TO_NODE20=true 在其工作流程中将其设置为“env”,或者将其设置为运行器机器上的环境变量,以强制使用 Node20。
- Assistant
The workflow YAML you've posted focuses on a CI/CD pipeline for a Python project, which includes setting up Python 3.10, installing dependencies, and running a specific Python script (
as.py). Additionally, it includes placeholders for some secret environment variables. Here are a few improvements and corrections:- : The variable should be set inside the block of the job.
- User
build The following actions uses Node.js version which is deprecated and will be forced to run on node20: actions/setup-python@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
- Assistant
To ensure that the actions using Node.js version 16 or older transition smoothly to Node.js version 20, you can enforce the use of Node.js 20 by defining the
ACTIONS_USE_NODE_VERSIONenvironment variable at the job level. This can help prevent any backward compatibility issues once the default Node.js version switches to 20.Here's how you can update your workflow to force the action to use Node.js 20:
name: CI/CD Workflow on: workflow_dispatch: schedule: - cron: '33 18 * * *' permissions: contents: read jobs: build: runs-on: ubuntu-latest timeout-minutes: 10 env: ACTIONS_USE_NODE_VERSION: '20' # Force all actions to use Node.js 20 steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Set up Python 3.10 uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install Python dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Run Python Script env: CLUB_USERNAME: ${{ secrets.USERNAME }} CLUB_PASSWORD: ${{ secrets.PASSWORD }} COOKIES: ${{ secrets.COOKIES }} TGBOTAPI: ${{ secrets.TGBOTAPI }} TGID: ${{ secrets.TGID }} run: | python ./as.py