Skip to content

fix(testing): check the changes when made in branches scope #14

fix(testing): check the changes when made in branches scope

fix(testing): check the changes when made in branches scope #14

Workflow file for this run

name: AndroSH Help Docs Generator
on:
push:
branches: [main, dev]
workflow_dispatch:
inputs:
reason:
description: 'Reason for running workflow'
required: false
default: 'Manual trigger'
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install --upgrade pip
[ -f requirements.txt ] && pip install -r requirements.txt
- name: Generate Help Documentation
run: |
# Create documentation file
DOC_FILE="AndroSH_Help.md"
# Header
echo "# AndroSH Command Line Reference" > "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo "> Complete documentation for all AndroSH commands and subcommands" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo "---" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
# Main help section
echo "## Main Command" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo '```' >> "$DOC_FILE"
python main.py --help 2>&1 >> "$DOC_FILE"
echo '```' >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
# Extract subcommands using whitespace pattern (successfully tested)
echo "## Available Subcommands" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
# Get subcommands and their descriptions
SUBCOMMANDS=$(python main.py --help 2>&1 | grep -E '^[[:space:]]+[a-z][a-z-]+[[:space:]]+' | awk '{print $1}')
# Convert to array
IFS=$'\n' read -r -d '' -a subcommands < <(echo "$SUBCOMMANDS" && printf "\0")
echo "✅ Found ${#subcommands[@]} subcommands: ${subcommands[*]}" >&2
# Create table of contents with descriptions
echo "| Command | Description |" >> "$DOC_FILE"
echo "|---------|-------------|" >> "$DOC_FILE"
# Process each subcommand for table
for cmd in "${subcommands[@]}"; do
# Get full line with description
FULL_LINE=$(python main.py --help 2>&1 | grep -E "^[[:space:]]+$cmd[[:space:]]+")
# Extract description (remove command name and leading spaces)
DESC=$(echo "$FULL_LINE" | sed -E "s/^[[:space:]]+$cmd[[:space:]]+//")
echo "| \`$cmd\` | $DESC |" >> "$DOC_FILE"
done
echo "" >> "$DOC_FILE"
echo "---" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
# Detailed help for each subcommand
echo "## Detailed Subcommand Help" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
for cmd in "${subcommands[@]}"; do
echo "" >> "$DOC_FILE"
echo "### \`python main.py $cmd\`" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo '```' >> "$DOC_FILE"
python main.py "$cmd" --help 2>&1 >> "$DOC_FILE" || echo "⚠️ No help available for $cmd" >> "$DOC_FILE"
echo '```' >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo "---" >> "$DOC_FILE"
done
# Footer
echo "*Documentation automatically generated by GitHub Actions*" >> "$DOC_FILE"
# Print summary
echo ""
echo "============================================="
echo "ANDROSH COMMAND LINE REFERENCE"
echo "============================================="
echo ""
echo "✅ Found ${#subcommands[@]} subcommands:"
for cmd in "${subcommands[@]}"; do
echo " • $cmd"
done
echo ""
echo "Full documentation saved to: $DOC_FILE"
- name: Print Documentation
run: |
echo "============================================="
echo " ANDROSH COMMAND LINE REFERENCE"
echo "============================================="
echo ""
cat AndroSH_Help.md
echo ""
echo "============================================="
echo " DOCUMENTATION COMPLETE"
echo "============================================="
- name: Commit and push documentation
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
mkdir -p Assets/docs
if [ -f "Assets/docs/AndroSH_Help.md" ]; then
if cmp -s "AndroSH_Help.md" "Assets/docs/AndroSH_Help.md"; then
echo "No changes detected - files are identical"
exit 0
else
echo "Content differs - updating file"
fi
else
echo "File doesn't exist - creating new file"
fi
mv AndroSH_Help.md Assets/docs/AndroSH_Help.md
git add Assets/docs/AndroSH_Help.md
git commit -m "docs: update AndroSH command line reference
Co-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
git push