How can I make sure that my github action workflow is working as intended?

Question:

I have a simple python script which classifies balls according to their type. The script is working as intended on my local machine.

How can I make sure that the git action workflow is running as well? I need to run the script every night. But for now I want to know if the workflow is even working.

This is my .yml file code:

name: Batch predictions

on:
  schedule:
    - cron: '* * * * *' 

jobs:
  predict:
    runs-on: ubuntu-latest
    steps:
    - name: check out repository content
    - uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.9'

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt

    - name: Execute py script
      run: python batch_predict.py

This is my github repo: https://github.com/kmeans27/ball-classification

Thank you for the help!

Asked By: Mark Müller

||

Answers:

  1. The workflow is not running since you have a typo in your workflow file. On line 11:

        - name: check out repository content
        - uses: actions/checkout@v2
    

    should be

        - name: check out repository content
          uses: actions/checkout@v2
    

    You can check GitHub Actions output here

  2. In ubuntu, you should use python3 instead of python to call your Python 3 environment.

  3. You can add an workflow_dispatch: entry in on.

    on:
      schedule:
        - cron: '* * * * *'
      workflow_dispatch:
    

    workflow_dispatch: event allows you to manually trigger a workflow execution.

  4. If you do want to trace into execution of your Python script, consider add a few print() in your code or use logging standard library.

Answered By: HuangFuSL
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.