Process Community Submissions #87
This file contains hidden or 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: Process Community Submissions | |
| on: | |
| schedule: | |
| - cron: '*/5 * * * *' # Runs every 5 minutes | |
| workflow_dispatch: # Allows you to manually trigger the workflow | |
| jobs: | |
| process-submissions: | |
| runs-on: ubuntu-latest # Run on a fresh Ubuntu environment | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 # Checkout your repository to the GitHub runner | |
| - name: Get Issues with Submission Label | |
| id: fetch_issues | |
| run: | | |
| issues=$(curl -H "Authorization: token ${{ secrets.ETHC }}" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| "https://api.github.com/repos/${{ github.repository }}/issues?labels=submission&state=open") | |
| echo "$issues" > issues.json # Save the fetched issues to a new issues.json file | |
| - name: Run Python Script to Process Submissions | |
| run: | | |
| python3 process_submissions.py # Run your Python script to process and update communities.json | |
| - name: Add Issues and Updated JSON to Git | |
| run: | | |
| git add issues.json # Add the new issues.json file to Git | |
| git add communities.json # Ensure the communities.json file is also added, if not already tracked | |
| - name: Commit Changes | |
| run: | | |
| git config --global user.name "github-actions[bot]" # Set user name for GitHub Actions bot | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" # Set user email for GitHub Actions bot | |
| git commit -m "Add new community submissions" # Commit the changes with a message | |
| git push # Push the changes back to your GitHub repository | |