name: Generate README on: push: branches: - main - '**' paths: - '**/*.sh' - '**/*.bat' - 'scripts/generate_readme.sh' - '.gitea/workflows/generate-readme.yml' jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 persist-credentials: false - name: Setup SSH with deploy key env: DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} run: | mkdir -p ~/.ssh chmod 700 ~/.ssh printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa ssh-keyscan -p 22113 -H git.hudsonriggs.systems >> ~/.ssh/known_hosts { echo "Host git.hudsonriggs.systems"; echo " HostName git.hudsonriggs.systems"; echo " Port 22113"; echo " User git"; } >> ~/.ssh/config chmod 600 ~/.ssh/config git remote set-url origin ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools.git - name: Generate README run: | bash scripts/generate_readme.sh - name: Commit changes run: | if git diff --quiet README.md; then echo "No README changes" exit 0 fi git config user.name "gitea-bot" git config user.email "gitea-bot@users.noreply.local" git add README.md git commit -m "docs: auto-generate README for scripts [skip ci]" - name: Push changes env: BRANCH_NAME: ${{ github.ref_name }} run: | : "Pushing to branch ${BRANCH_NAME} via SSH" git push origin HEAD:"${BRANCH_NAME}"