Add files via upload #202
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: Progress Tracker | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
update-progress: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install Dependencies | |
run: | | |
pip install markdown matplotlib | |
- name: Create Required Directories | |
run: | | |
mkdir -p .github/workflows/logs | |
mkdir -p .github/historical_data | |
# Initialize with empty JSON if doesn't exist | |
[ ! -f .github/historical_data/initial_data.json ] && echo '{"initialization_date": "'$(date -u '+%Y-%m-%dT%H:%M:%SZ')'"}' > .github/historical_data/initial_data.json | |
[ ! -f .github/workflows/logs/workflow_init.json ] && echo '{"initialization_date": "'$(date -u '+%Y-%m-%dT%H:%M:%SZ')'"}' > .github/workflows/logs/workflow_init.json | |
- name: Generate Progress Report | |
run: | | |
python .github/scripts/generate_report.py | |
echo "Content of chart_data.json:" | |
cat chart_data.json | |
echo "Content of Progress_Report.md:" | |
cat Progress_Report.md | |
- name: Save Workflow Run Data | |
run: | | |
echo "{ | |
\"run_id\": \"$GITHUB_RUN_ID\", | |
\"date\": \"$(date -u '+%Y-%m-%dT%H:%M:%SZ')\", | |
\"trigger\": \"$GITHUB_EVENT_NAME\", | |
\"repository\": \"$GITHUB_REPOSITORY\", | |
\"workflow\": \"$GITHUB_WORKFLOW\" | |
}" > .github/workflows/logs/run_$GITHUB_RUN_ID.json | |
- name: Commit and Push Reports | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add Progress_Report.md | |
git add progress_dashboard.html | |
git add chart_data.json | |
git commit -m "Update progress report [skip ci]" || echo "No changes to commit" | |
git remote set-url origin https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }} | |
git push |