Fix error handling for attachments and provide example of delays and … #38
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: Set up the repository | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| cleanup: | |
| name: Set up the repository | |
| runs-on: ubuntu-latest | |
| if: github.event.repository.name != 'airdrop-template' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Replace templates | |
| run: | | |
| shopt -s dotglob | |
| export LC_CTYPE=C | |
| export LANG=C | |
| # Project name is lowercase repository name (used in configs) | |
| REPO_NAME="${GITHUB_REPOSITORY,,}" # Of the form owner/repo | |
| REPO_NAME="${REPO_NAME##*/}" # Just the repo name | |
| # Extract EXTERNAL_SYSTEM from the project name | |
| # Expected format: airdrop-{EXTERNAL_SYSTEM}-snap-in where {EXTERNAL_SYSTEM} can be multiple words with dashes | |
| EXTERNAL_SYSTEM="TODO" | |
| if [[ "$REPO_NAME" =~ ^airdrop-(.+)-snap-in$ ]]; then | |
| EXTERNAL_SYSTEM="${BASH_REMATCH[1]}" | |
| fi | |
| # Create pretty version of external system name with proper capitalization | |
| PRETTY_EXTERNAL_SYSTEM="$(echo "$EXTERNAL_SYSTEM" | sed 's/-/ /g; s/\b\(.\)/\u\1/g')" | |
| ESCAPED_PRETTY_EXTERNAL_SYSTEM="$(echo "$PRETTY_EXTERNAL_SYSTEM" | sed 's/ /\\ /g')" | |
| echo "Project name: '$REPO_NAME'" | |
| echo "External system name: '$EXTERNAL_SYSTEM'" | |
| echo "Pretty external system name: '$PRETTY_EXTERNAL_SYSTEM'" | |
| echo "Replacing TODO placeholders in manifest.yaml and README.md" | |
| sed -i "s/Todo/$ESCAPED_PRETTY_EXTERNAL_SYSTEM/g" manifest.yaml | |
| sed -i "s/Todo/$ESCAPED_PRETTY_EXTERNAL_SYSTEM/g" .github/templates/README.md | |
| sed -i "s/airdrop-todo-snap-in/airdrop-$EXTERNAL_SYSTEM-snap-in/g" manifest.yaml | |
| echo "Moving template files to the root of the repository" | |
| mv -f .github/templates/* . | |
| rm -rf .github | |
| cp .cursor/mcp.json .mcp.json | |
| # Create CLAUDE.md from initial-mapping.mdc, removing the header | |
| sed '1,/^---$/d' initial-mapping.mdc | sed '1,/^$/d' > CLAUDE.md | |
| - name: Commit | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add . | |
| git commit --amend --no-edit | |
| - name: Push | |
| uses: ad-m/[email protected] | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: main | |
| force: true |