Home > Back-end >  Propagating or setting up GitHub Classroom Workflow
Propagating or setting up GitHub Classroom Workflow

Time:12-08

I'm experimenting with setting up GitHub Classroom (after getting really tired of manually running tests for student submissions this term). I picked one of the tests from the class I am just finishing, but for the test script I have there, I need Python 3.10; earlier versions won't do.

I tried setting up .github/workflows/classroom.yml to specify the Python version. If I set it to this, in a student repository, I can get my tests to run:

    name: GitHub Classroom Workflow

    on: [push]

    jobs:
      build:
        name: Autograding
        runs-on: ubuntu-latest
        steps:
          - uses: actions/setup-python@v2
            with:
                python-version: "3.10"
          - uses: actions/checkout@v2
          - uses: education/autograding@v1

but (of course) I don't want my students to do this manually whenever they check out an assignment. So, I tried adding the same to the template repository, but that doesn't seem to affect the student repository when I make a new one of those. There, I get the default I got before

    name: GitHub Classroom Workflow

    on: [push]

    jobs:
      build:
        name: Autograding
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - uses: education/autograding@v1

Is there a way to specify what the workflow should be for an assignment or classroom? Or a way to get it from the template?

CodePudding user response:

Or a way to get it from the template?

Your template could include a workflow, meaning reuse an existing workflow (possible since Oct. 2021)

The "Reusable workflows and workflow templates" section includes:

Inside workflow templates, you can also reference reusable workflows to make it easy for people to benefit from reusing centrally managed workflow code.

If your reusable workflow comes with the right python-version, nothing will have to be set up manually.

  • Related