Automated issue creation and issue close based on test results

Hey all! I’m looking for feedback with regards to my autograding workflow. I’ve recently added automated issue creation and closure, based on whether or not the student submission passes the automatic tests.

In the code below, my student’s submission is src.exercise.py

.github/ISSUE_TEMPLATE.md

---
title: Test Failure
labels: bug
assignees: $payload.sender.login

---
## {{ date | date("dddd, MMMM Do YYYY") }}

> Your program submission did not pass the test case(s) listed in the rubric on Canvas. 

## Find the Issue

1. Open the assignment on [Canvas](https://uvu.instructure.com/). Execute your program with the inputs listed in the rubric's test cases. Does your output match what's expected? 
    - Look closely at the formatting, punctuation, white space, and capitalization... it must match exactly.
<br>

2. Read the directions and problem statement again very closely. Did you miss any small details?

3. Re-write your algorithm from scratch before updating your program. 
    - Video: [What is psuedocode and how do you use it?](https://youtu.be/PwGA4Lm8zuE)
<br>

4. Getting program execution errors? Google may be your best friend...
    - Video: [How to Debug your Code](https://youtu.be/NTaNksV-DPY)
    - Video: [What to do when you are stuck](https://youtu.be/h01U6uDhNk4)
<br>

5. Need help with Python?
    - python.org [Official Tutorial](https://docs.python.org/3/tutorial/index.html)
    - [Sololearn Python Tutorial](https://www.sololearn.com/learning/1073)
    - Python Video Tutorials: [1](https://youtube.com/playlist?list=PLlrxD0HtieHhS8VzuMCfQD4uJ9yne1mE6), [2](https://youtube.com/playlist?list=PLlrxD0HtieHiXd-nEby-TMCoUNwhbLUnj), and [3](https://youtube.com/playlist?list=PLlrxD0HtieHhHnCUVtR8UHS7eLl33zfJ-)

.github/workflows/workflow.yml

name: Build and Test

on:
  push:
    paths: 
      - 'src/exercise.py'  
                                                                                
jobs:  
  build_and_test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
      with:
        python-version: '3.x'
      
    - name: Run Tests
      run: |
        python3 -m pip install --upgrade pip
        pip install pytest flake8
        flake8 src/exercise.py --count --select=E9,F63,F7,F82 --show-source --statistics
        flake8 src/exercise.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
        python3 -m pytest
        
    - name: Create Issue (if tests fail)
      if: failure()
      uses: JasonEtco/create-an-issue@v2
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        update_existing: true
        assignees: ${{ GITHUB.ACTOR }}  
               
    - name: Close Issue (if tests pass)
      if: success()
      uses: actions/stale@v3
      with:
        only-labels: 'bug'
        stale-issue-label: 'resolved'
        stale-issue-message: 'Student Program passes all tests. Issue is resolved'
        close-issue-message: 'Closing issue.'
        days-before-issue-stale: 0
        days-before-close: 0

Issue Tab after failing, then passing tests

Would it be a better flow if I were to place the steps that open and close the issue in an action.yml file in the same same subfolder as the issue template? Or does that make the flow more complex? IDK

© 2017 GitHub, Inc.
with by
GitHub Education