give me a bash script i can run from the command line that: 1. downloads my github repo…
- User
give me a bash script i can run from the command line that:
- downloads my github repo from: myname/myrepo
- deletes the folder named "/remove-from-context"
- deletes all the poetry.lock files.
- adds back (or makes visible) the .github folder
- zips the repo
Assistant
Here's a bash script that accomplishes all the tasks you specified. You can save this as
process_repo.sh, make it executable withchmod +x process_repo.sh, and then run it from the command line.#!/bin/bash # Configuration REPO_URL="https://github.com/myname/myrepo.git" TEMP_DIR="temp_repo" OUTPUT_ZIP="processed_repo.zip" # Step 1: Download the GitHub repository echo "Cloning repository..." git clone --depth 1 "$REPO_URL" "$TEMP_DIR" || { echo "Failed to clone repository" exit 1 } # Step 2: Delete the /remove-from-context folder echo "Removing /remove-from-context folder..." rm -rf "${TEMP_DIR}/remove-from-context" # Step 3: Delete all poetry.lock files echo "Removing all poetry.lock files..." find "$TEMP_DIR" -name "poetry.lock" -type f -delete # Step 4: Ensure .github folder is visible (GitHub should already include it, but we'll make sure) echo "Ensuring .github folder is present..." mkdir -p "${TEMP_DIR}/.github" # Step 5: Zip the repository echo "Creating zip archive..." cd "$TEMP_DIR" || exit 1 zip -r "../$OUTPUT_ZIP" ./* || { echo "Failed to create zip archive" exit 1 } cd .. # Cleanup echo "Cleaning up..." rm -rf "$TEMP_DIR" echo "Done! The processed repository is in $OUTPUT_ZIP"How to use:
- Save this script to a file (e.g.,
process_repo.sh) - Make it executable:
chmod +x process_repo.sh - Run it:
./process_repo.sh
Notes:
- The script will create a zip file named
processed_repo.zipin the current directory. - It uses
git clone --depth 1to only get the latest commit (faster and uses less bandwidth). - The script includes error checking for the clone and zip operations.
- The
.githubfolder should already be included if it exists in your repository, but the script ensures it exists (creating an empty one if needed). - The script cleans up the temporary directory after creating the zip file.
- Save this script to a file (e.g.,
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.