mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
163 lines
5.6 KiB
YAML
163 lines
5.6 KiB
YAML
name: TODO to Issues Sync
|
||
|
||
# This workflow can be triggered manually to convert TODO items to GitHub issues
|
||
# or can be run on a schedule to keep issues in sync with TODO files
|
||
|
||
on:
|
||
workflow_dispatch:
|
||
inputs:
|
||
mode:
|
||
description: 'Execution mode'
|
||
required: true
|
||
type: choice
|
||
options:
|
||
- dry-run
|
||
- export-json
|
||
- create-issues
|
||
default: 'dry-run'
|
||
|
||
filter_priority:
|
||
description: 'Filter by priority (leave empty for all)'
|
||
required: false
|
||
type: choice
|
||
options:
|
||
- ''
|
||
- critical
|
||
- high
|
||
- medium
|
||
- low
|
||
|
||
filter_label:
|
||
description: 'Filter by label (e.g., security, frontend)'
|
||
required: false
|
||
type: string
|
||
|
||
exclude_checklist:
|
||
description: 'Exclude checklist items'
|
||
required: false
|
||
type: boolean
|
||
default: true
|
||
|
||
limit:
|
||
description: 'Limit number of issues (0 for no limit)'
|
||
required: false
|
||
type: number
|
||
default: 0
|
||
|
||
# Uncomment to run on a schedule (e.g., weekly)
|
||
# schedule:
|
||
# - cron: '0 0 * * 0' # Every Sunday at midnight
|
||
|
||
jobs:
|
||
convert-todos:
|
||
runs-on: ubuntu-latest
|
||
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v6
|
||
|
||
- name: Set up Python
|
||
uses: actions/setup-python@v5
|
||
with:
|
||
python-version: '3.11'
|
||
|
||
- name: Install GitHub CLI
|
||
run: |
|
||
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
|
||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
|
||
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
|
||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
|
||
&& sudo apt update \
|
||
&& sudo apt install gh -y
|
||
|
||
- name: Authenticate GitHub CLI
|
||
env:
|
||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
run: |
|
||
echo "$GH_TOKEN" | gh auth login --with-token
|
||
gh auth status
|
||
|
||
- name: Build command arguments
|
||
id: args
|
||
run: |
|
||
ARGS=""
|
||
|
||
# Add mode
|
||
if [ "${{ inputs.mode }}" = "dry-run" ]; then
|
||
ARGS="$ARGS --dry-run"
|
||
elif [ "${{ inputs.mode }}" = "export-json" ]; then
|
||
ARGS="$ARGS --output todos-export.json"
|
||
elif [ "${{ inputs.mode }}" = "create-issues" ]; then
|
||
ARGS="$ARGS --create"
|
||
fi
|
||
|
||
# Add filters
|
||
if [ -n "${{ inputs.filter_priority }}" ]; then
|
||
ARGS="$ARGS --filter-priority ${{ inputs.filter_priority }}"
|
||
fi
|
||
|
||
if [ -n "${{ inputs.filter_label }}" ]; then
|
||
ARGS="$ARGS --filter-label ${{ inputs.filter_label }}"
|
||
fi
|
||
|
||
if [ "${{ inputs.exclude_checklist }}" = "true" ]; then
|
||
ARGS="$ARGS --exclude-checklist"
|
||
fi
|
||
|
||
# Add limit if specified
|
||
if [ "${{ inputs.limit }}" != "0" ]; then
|
||
ARGS="$ARGS --limit ${{ inputs.limit }}"
|
||
fi
|
||
|
||
echo "args=$ARGS" >> $GITHUB_OUTPUT
|
||
echo "Command arguments: $ARGS"
|
||
|
||
- name: Run populate-kanban script
|
||
env:
|
||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
run: |
|
||
echo "skipping tools-based populate-kanban (tools/ removed)"
|
||
|
||
- name: Upload JSON export (if applicable)
|
||
if: inputs.mode == 'export-json'
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: todos-export
|
||
path: todos-export.json
|
||
retention-days: 30
|
||
|
||
- name: Create summary
|
||
if: always()
|
||
run: |
|
||
echo "## TODO to Issues Conversion" >> $GITHUB_STEP_SUMMARY
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "**Mode:** ${{ inputs.mode }}" >> $GITHUB_STEP_SUMMARY
|
||
|
||
if [ -n "${{ inputs.filter_priority }}" ]; then
|
||
echo "**Priority Filter:** ${{ inputs.filter_priority }}" >> $GITHUB_STEP_SUMMARY
|
||
fi
|
||
|
||
if [ -n "${{ inputs.filter_label }}" ]; then
|
||
echo "**Label Filter:** ${{ inputs.filter_label }}" >> $GITHUB_STEP_SUMMARY
|
||
fi
|
||
|
||
if [ "${{ inputs.exclude_checklist }}" = "true" ]; then
|
||
echo "**Checklist Items:** Excluded" >> $GITHUB_STEP_SUMMARY
|
||
fi
|
||
|
||
if [ "${{ inputs.limit }}" != "0" ]; then
|
||
echo "**Limit:** ${{ inputs.limit }} items" >> $GITHUB_STEP_SUMMARY
|
||
fi
|
||
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
|
||
if [ "${{ inputs.mode }}" = "export-json" ]; then
|
||
echo "✅ JSON export created successfully" >> $GITHUB_STEP_SUMMARY
|
||
echo "Download the artifact from the workflow run page" >> $GITHUB_STEP_SUMMARY
|
||
elif [ "${{ inputs.mode }}" = "create-issues" ]; then
|
||
echo "✅ GitHub issues created successfully" >> $GITHUB_STEP_SUMMARY
|
||
echo "View issues: https://github.com/${{ github.repository }}/issues" >> $GITHUB_STEP_SUMMARY
|
||
else
|
||
echo "ℹ️ Dry run completed - no issues created" >> $GITHUB_STEP_SUMMARY
|
||
fi
|