Volunteer Accessible Tasks Board Proposal #46
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: Clean Promotion Checklist | |
| on: | |
| issues: | |
| types: [opened] | |
| permissions: | |
| issues: write | |
| jobs: | |
| clean-promotion-checklist: | |
| runs-on: ubuntu-latest | |
| if: contains(join(github.event.issue.labels.*.name, ','), 'promotions-workflow') | |
| steps: | |
| - name: Extract checked items and update issue body | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const issue = context.payload.issue; | |
| const body = issue.body; | |
| const lines = body.split('\n'); | |
| const startIndex = lines.findIndex(line => | |
| line.includes('✅ Acceptance Criteria') || | |
| line.includes(':white_check_mark: Acceptance Criteria') | |
| ); | |
| if (startIndex === -1) { | |
| console.log("Acceptance Criteria section not found."); | |
| return; | |
| } | |
| const headerLines = lines.slice(0, startIndex + 2); // Keep until checklist intro | |
| const checklistLines = lines.slice(startIndex + 2); | |
| const keptLines = checklistLines.filter(line => | |
| /\[\s*x\s*\]/i.test(line) | |
| ); | |
| const normalized = keptLines.map(line => | |
| line.replace(/\[\s*x\s*\]/i, '[x]') | |
| ); | |
| const unChecked = normalized.map(line => line.replace('[x]', '[ ]')); | |
| const newBody = [...headerLines, ...unChecked].join('\n'); | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| body: newBody | |
| }); |