Submissions via Issues #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Submissions via Issues | |
on: | |
issue_comment: | |
types: [created, edited] | |
jobs: | |
approval: | |
# this job only runs for issue comments | |
name: Check if submission is approved | |
runs-on: ubuntu-latest | |
if: ${{ github.event.issue.number }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Check if authorized member has approved submission | |
run: | | |
pip install requests | |
python ${GITHUB_WORKSPACE}/.github/helper/approval.py | |
env: | |
ISSUE_NUMBER: ${{ github.event.issue.number }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
contribution: | |
name: Extract, Commit & Push submission to default branch | |
runs-on: ubuntu-latest | |
needs: approval | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- uses: stefanbuck/github-issue-parser@v3 | |
id: issue-parser | |
with: | |
template-path: ${GITHUB_WORKSPACE}/.github/ISSUE_TEMPLATE/new_submission.yml | |
- name: Update submissions file | |
run: python ${GITHUB_WORKSPACE}/.github/helper/update.py | |
env: | |
submission_entry: ${{ steps.issue-parser.outputs.jsonString }} | |
- name: Record Sorter | |
run: python ${GITHUB_WORKSPACE}/.github/helper/record_sorter.py | |
- name: Commit + Push changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: 'docs: New Submission via Issue' | |
cleanup: | |
name: Close Issue thread after successful contribution | |
runs-on: ubuntu-latest | |
needs: contribution | |
steps: | |
- name: Close Issue | |
uses: peter-evans/close-issue@v3 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
comment: Auto-closing issue since commit has been pushed to main branch |