git-sticker
git-sticker copied to clipboard
Hey Jeff! Use this script to automatically merge all the PR's
Hi @codediodeio ,
Pretty sure you don't want to manually merge all these PR's. So you can use the below bash script to do some of the heavy lifting. You'll need to modify it for your decryption step to be automated as well, but this should be a good starting point.
Disclaimer: The auto merging will only work if there aren't any merge conflicts, so here's hoping 🤞🏻
# List all pull requests to master and grab the first half (before space) of each line
git ls-remote origin 'pull/*/head' | awk '{print $1}' |
# Loop through all the lines
while read ref; do
# Clean up the line
pr=$(echo $ref | cut -d/ -f3)
echo "Attempting to automatically merge and decrypt from pull request $ref"
# Merge the PR automagically (if it is valid)
git merge --no-ff $ref -m "Auto merge of pull request $ref"
done
# Once everything is merged, loop through all text files in stickers dir
for entry in stickers/*
do
echo "Attempting to decrypt $entry"
# Maybe your script should take a file name as an arg? Then you can use the below
address=$(npm run test --someArg $entry)
# Do something with your decrypted address :)
echo $address
done
I guess Jeff loves us all and he'll go through that manually and say something nice for trying 😉
This looks awesome! Thank you so much 👍
Might need some more code to do some checks such as:
- Whether they only edit one file. (the package-lock JSON trick was clever!)
- Whether the encrypted string is valid (isn't missing any characters)
- Whether they consist of only one commit.
Those are all I can think of off the top of my head. What do you guys think?
- Whether they consist of only one commit.
Would the number of commits matter if only one file is changed? I don't think one commit was a requirement, but I might be missing something.
- Whether they consist of only one commit.
Would the number of commits matter if only one file is changed? I don't think one commit was a requirement, but I might be missing something.
Ah, must have read it wrong. As long as one file is edited all should be good then!
Other considerations might be to check if the master branch was edited in the PR, as one could infer from the instructions that it's not allowed - changes should only be merged from your own custom-named branch. Or maybe this is too strict?
I ended up putting something together with the GitHub GraphQL API to validate the PRs. I'll give @ascendedco a shoutout in the video follow-up bc this is a helpful little script.
@codediodeio, can you please enable the script? :)