Skip to content

WbW Tools List (Roadmap) #40

WbW Tools List (Roadmap)

WbW Tools List (Roadmap) #40

name: Progress Tracker
on:
issues:
types: [opened, edited]
workflow_dispatch:
permissions:
issues: read
jobs:
calculate-progress:
runs-on: ubuntu-latest
steps:
- name: Get issue content
id: issue
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: 1
});
core.setOutput('content', issue.data.body);
- name: Calculate progress
id: progress
run: |
python3 -c "
import os
content = '''${{ steps.issue.outputs.content }}'''
completed = content.count('- [x]')
total = completed + content.count('- [ ]')
percentage = (completed / total * 100) if total > 0 else 0
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
print(f'completed={completed}', file=f)
print(f'total={total}', file=f)
print(f'percentage={percentage:.1f}', file=f)
"
- name: Initialize/Update Gist
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GIST_SECRET }}
script: |
const gist_id = '0c46250def94614c4a3ef8b4de7460e6';
const filename = 'wbw-progress.json';
const content = {
schemaVersion: 1,
label: "WbW Tools ported",
message: "${{ steps.progress.outputs.percentage }}% (${{ steps.progress.outputs.completed }}/${{ steps.progress.outputs.total }})",
color: "d5ad18"
};
try {
await github.rest.gists.update({
gist_id: gist_id,
files: {
[filename]: {
content: JSON.stringify(content)
}
}
});
} catch (error) {
console.log('Error updating gist:', error);
}
- name: Update progress badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 0c46250def94614c4a3ef8b4de7460e6
filename: wbw-progress.json
label: WbW Tools ported
message: "${{ steps.progress.outputs.percentage }}% (${{ steps.progress.outputs.completed }}/${{ steps.progress.outputs.total }})"
color: d5ad18