Skip to content

Commit

Permalink
chore: redo typo script (#5926)
Browse files Browse the repository at this point in the history
Formalizing our policy of dissuading metrics farming through typo PRs
while accepting the contribution
Example output #5925
  • Loading branch information
ludamad authored Apr 22, 2024
1 parent 0e81642 commit 41fa87e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions scripts/redo-typo-pr
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -eux

# Configuration
ORIGINAL_PR_NUMBER=$1
REPO='AztecProtocol/aztec-packages'
NEW_BRANCH="chore/typo-redo-$ORIGINAL_PR_NUMBER"
AUTHOR=`gh pr view $ORIGINAL_PR_NUMBER --json author --jq '.author.login'`

# Step 1: Checkout the PR locally
echo "Checking out PR #$ORIGINAL_PR_NUMBER"
gh pr checkout $ORIGINAL_PR_NUMBER

# Step 2: Create a new local branch
echo "Creating new local branch $NEW_BRANCH"
git checkout -b $NEW_BRANCH

# Step 3: Push the new branch to GitHub
echo "Pushing new branch $NEW_BRANCH to GitHub"
git commit --amend --author="AztecBot <[email protected]>" --no-edit
git push origin $NEW_BRANCH

# Step 4: create a new pull request
echo "Creating a new pull request for $NEW_BRANCH"
gh pr create --base master --head $NEW_BRANCH --title "chore: redo typo PR by $AUTHOR" --body "Thanks $AUTHOR for https://github.com/$REPO/pull/$ORIGINAL_PR_NUMBER. Our policy is to redo typo changes to dissuade metric farming. This is an automated script."

# Step 5: Close the original PR
echo "Closing original PR #$ORIGINAL_PR_NUMBER"
gh pr close $ORIGINAL_PR_NUMBER --delete-branch

echo "Script completed."

0 comments on commit 41fa87e

Please sign in to comment.