|
| 1 | +name: Weekly Status Markdown |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 14 * * MON" # Mondays 07:00 PT (14:00 UTC) |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-status: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + contents: read |
| 13 | + issues: write # needed to create/update issues |
| 14 | + pull-requests: write # needed to post/update a PR comment |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set up Python |
| 19 | + uses: actions/setup-python@v5 |
| 20 | + with: |
| 21 | + python-version: "3.11" |
| 22 | + |
| 23 | + - name: Install deps |
| 24 | + run: pip install requests |
| 25 | + |
| 26 | + - name: Get current date |
| 27 | + id: date |
| 28 | + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT |
| 29 | + |
| 30 | + - name: Generate weekly status markdown |
| 31 | + id: gen |
| 32 | + env: |
| 33 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + REPO: input-output-hk/acropolis |
| 35 | + # --- Use ONE of the two approaches below --- |
| 36 | + |
| 37 | + # A) Projects v2 (recommended): |
| 38 | + PROJECT_OWNER: input-output-hk |
| 39 | + PROJECT_NUMBER: 7 |
| 40 | + STATUS_DONE_VALUE: Done |
| 41 | + STATUS_INPROGRESS_VALUE: In Progress |
| 42 | + |
| 43 | + # B) Fallback via labels: |
| 44 | + # DONE_LABELS: "status: done,done" |
| 45 | + # INPROGRESS_LABELS: "status: in progress,in progress" |
| 46 | + |
| 47 | + OUTPUT_PATH: artifacts/weekly_status.md |
| 48 | + run: | |
| 49 | + mkdir -p artifacts |
| 50 | + python scripts/weekly_status_markdown.py | tee /tmp/out.md |
| 51 | + echo "md<<EOF" >> $GITHUB_OUTPUT |
| 52 | + cat /tmp/out.md >> $GITHUB_OUTPUT |
| 53 | + echo "EOF" >> $GITHUB_OUTPUT |
| 54 | +
|
| 55 | + - name: Upload markdown artifact |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: weekly-status |
| 59 | + path: artifacts/weekly_status.md |
| 60 | + if-no-files-found: warn |
| 61 | + |
| 62 | + # Create GitHub Issue with weekly status |
| 63 | + - name: Create Weekly Status Issue |
| 64 | + if: ${{ github.event_name != 'pull_request' }} |
| 65 | + uses: actions/github-script@v7 |
| 66 | + with: |
| 67 | + script: | |
| 68 | + console.log('Event name:', context.eventName); |
| 69 | + console.log('Checking if artifacts/weekly_status.md exists...'); |
| 70 | +
|
| 71 | + const fs = require('fs'); |
| 72 | + if (!fs.existsSync('artifacts/weekly_status.md')) { |
| 73 | + console.log('❌ artifacts/weekly_status.md not found!'); |
| 74 | + throw new Error('Weekly status file not found'); |
| 75 | + } |
| 76 | +
|
| 77 | + const content = fs.readFileSync('artifacts/weekly_status.md', 'utf8'); |
| 78 | + console.log('✅ File read successfully, length:', content.length); |
| 79 | +
|
| 80 | + const issue = await github.rest.issues.create({ |
| 81 | + owner: context.repo.owner, |
| 82 | + repo: context.repo.repo, |
| 83 | + title: `📊 Weekly Status - Week of ${{ steps.date.outputs.date }}`, |
| 84 | + body: content, |
| 85 | + labels: ['weekly-status', 'automated'] |
| 86 | + }); |
| 87 | +
|
| 88 | + console.log('✅ Issue created successfully:', issue.data.html_url); |
0 commit comments