0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitHubActionsで定期実行

Posted at

Actionsタブのset up a workflow yourselfをクリック

image.png

.github/workflows/schedule.yml
name: Schedule abc.py

on:
  schedule:
    - cron: '15 1 * * *' # 毎日10:15にジョブを実行
  workflow_dispatch:

jobs:
  run-abc:
    runs-on: ubuntu-latest

    steps:
      # リポジトリをクローン
      - name: Checkout repository
        uses: actions/checkout@v3

      # Python環境をセットアップ
      - name: Set up Python environment
        uses: actions/setup-python@v4
        with:
          python-version: '3.12'

      # 依存関係をインストール
      - name: Install dependencies
        run: pip install -r requirements.txt

      # 必要な環境変数をセット
      - name: Set environment variables
        env:
          DEVELOPER_KEY: ${{ secrets.DEVELOPER_KEY }}
        run: echo "Environment variables set"

      # abc.pyを実行
      - name: Execute abc.py
        env:
         DEVELOPER_KEY: ${{ secrets.DEVELOPER_KEY }}
        run: python abc.py

環境変数はレポジトリのSettings>Security>Secrets and variables>ActionsのSecretsに設定

Actions>Schedule abc.pyのRun workflowから手動実行

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?