All Projects โ†’ duolingo โ†’ pulldozer

duolingo / pulldozer

Licence: Apache-2.0 License
CLI tool for batch editing multiple repos ๐Ÿšœ

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to pulldozer

backup-github-repo
Backup all the issues and pull requests of a Github repo, including the comments, events, and labels, as JSON and as HTML
Stars: โœญ 31 (+40.91%)
Mutual labels:  pr
Hacktoberfest-Guide-2019
เถšเทœเถฝเทŠเถฝเถฑเทŠเถง เถšเท™เถฝเทŠเถฝเถฑเทŠเถง Hacktoberfest เถงเท“ เท‚เถปเทŠเถงเทŠ๐Ÿ‘‰ Hacktoberfest 2019 opensource guide. Happy Open Sourceโค๏ธ๐Ÿ˜๐Ÿ˜โค๏ธ Do Your Activity Here ๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡
Stars: โœญ 11 (-50%)
Mutual labels:  pr
pr-reviews-reminder-action
A GitHub Action to send Slack/Teams notification for Pull Request that are waiting for reviewers.
Stars: โœญ 18 (-18.18%)
Mutual labels:  pr
code-review-culture
๐Ÿ“– The art of cultivating a strong dev culture in your team.
Stars: โœญ 19 (-13.64%)
Mutual labels:  pr
Github Issue Templates
๐Ÿ”ฃ A collection of GitHub issue and pull request templates
Stars: โœญ 3,074 (+13872.73%)
Mutual labels:  pr
HacktoberFest-2020
Open source is changing the world. Join global community for the yearly celebration of open source software!
Stars: โœญ 21 (-4.55%)
Mutual labels:  pr

Pulldozer

Pulldozer is a simple CLI tool for batch editing multiple GitHub repos.

You give Pulldozer a transformation script and it spits out pull requests. There are no other side effects - your existing local repos will remain untouched.

Usage

Clone this repo onto any Unix machine that has curl. Set your GITHUB_TOKEN environment variable to an access token with repo scope and SSO enabled.

To perform a batch edit:

  1. Specify your desired COMMIT_MESSAGE string, REPOS list, and transform function in a shell script:

    COMMIT_MESSAGE='Fix "langauge" typos'
    
    transform() { # $1=org name, $2=repo name
      # Replace all occurrences of "langauge" with "language"
      git grep --cached -z -l '' | xargs -0 gsed -i 's/langauge/language/g'
    }
    
    REPOS='
    artnc/dotfiles
    duolingo/halflife-regression
    duolingo/rtl-viewpager
    '
    
    # Optional: Markdown to include in pull request description
    DESCRIPTION='[Correct spelling](https://en.wiktionary.org/wiki/language)'
    Shell skills rusty? Click here for a cheat sheet.
    • List all Git-tracked files containing $needle with git grep --cached -l $needle
      • To simply list all files, specify -l ''
      • -z will use \0 instead of newline as the delimiter
        • Required if you'll be piping paths containing whitespace into xargs
      • Symlinks and submodules are excluded
    • Pipe a file list into xargs $command to run $command $file on each file in the list
      • Use xargs -0 if the input is \0-delimited rather than newline-delimited
    • Replace strings in a file with gsed -i -e 's/myRegex/mySubstitution/g' $file
      • You can use any character in place of / as the delimiter if conflicts arise
      • You can specify -E and then reference parenthesized capture groups with \1 etc.
      • You can declare multiple substitutions by placing -e before each one
      • To replace newlines, add -e ':a' -e 'N' -e '$!ba' before your own -e 's/\n/foobar/g'
    Really want to use some other language? Click here for a Python example.

    The transform functions below will add a spring.application.name=$REPO_NAME line immediately after the app.environment line in all files matching src/main/resources/*.properties that don't already contain a spring.application.name line.

    • Python version:
      transform() {
        python3 - << EOF
      import re
      import subprocess
      
      git_paths = subprocess.check_output("git grep --cached -l ''", shell=True)
      for path in git_paths.decode().splitlines():
          if not re.search(r'^src/main/resources/.*\.properties$', path):
              continue
          with open(path) as f:
              contents = f.read()
          if re.search(r'spring\.application\.name', contents):
              continue
          with open(path, 'w') as f:
              f.write(re.sub(r'(app\.environment=\w*)', r'\1\nspring.application.name=${2}', contents))
      EOF
      }
    • Shell version:
      transform() {
        for path in $(git grep --cached -l ''); do
          if ! printf %s "${path}" | grep -qE '^src/main/resources/.*\.properties$'; then
            continue
          fi
          if grep -qF 'spring.application.name' "${path}"; then
            continue
          fi
          sed -E -i "s/(app\.environment=\w*)/\1\nspring.application.name=${2}/g" "${path}"
        done
      }
  2. Run ./pulldozer /path/to/script.sh. (To use Bash in your transformation script, prepend bash to that command - otherwise Pulldozer assumes POSIX sh.) Pulldozer will ask for confirmation and then open PRs, each of which will contain your transformation script in its description.

    Screenshot

Duolingo is hiring! Apply at https://www.duolingo.com/careers

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].