Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hey Jeff! Use this script to automatically merge all the PR's #379

Open
onlyamessenger opened this issue Mar 17, 2020 · 7 comments
Open

Comments

@onlyamessenger
Copy link
Contributor

onlyamessenger commented Mar 17, 2020

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
@daniels20000
Copy link
Contributor

I guess Jeff loves us all and he'll go through that manually and say something nice for trying 😉

@codediodeio
Copy link
Member

This looks awesome! Thank you so much 👍

@Ry-DS
Copy link
Contributor

Ry-DS commented Mar 18, 2020

Might need some more code to do some checks such as:

  1. Whether they only edit one file. (the package-lock JSON trick was clever!)
  2. Whether the encrypted string is valid (isn't missing any characters)
  3. 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?

@Snarr
Copy link
Contributor

Snarr commented Mar 18, 2020

  1. 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.

@Ry-DS
Copy link
Contributor

Ry-DS commented Mar 18, 2020

  1. 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?

@codediodeio
Copy link
Member

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.

@TheDechev
Copy link

@codediodeio, can you please enable the script? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants