Use FastLane to create PRs

This is a guide on how to set up a fastlane lane to create pull requests:

  1. Set Up Fastlane:
    1. Add a Gemfile file in the root of the repo
    2. Add these to the Gemfile:
     source "https://rubygems.org"
    
     gem "fastlane"
    
    1. Run bundle update
    2. Run bundle exec fastlane init
  2. Set Up the PR lane:
    1. Run cd fastlane
    2. Edit the Fastfile file to add the PR lane:
  3. Add your Github PAT to an environment file:
    1. Create a new file called .env inside the fastlane folder.
    2. Paste this inside:
       GITHUB_API_TOKEN="YOUR_GITHUB_PAT"
      
    3. Add the .env file to the .gitignore:
       fastlane/.env
      
  4. Run the lane:
    1. bundle exec fastlane pr
  5. Additionally, you could add an alias to the .zshrc file for easier usage:
    1. Run vim ~/.zshrc
    2. Add a new alias:
       alias pr='cd ~/your-project && bundle exec fastlane pr'
      
  6. Also additionally, you could add some documentation to your Contributing guidelines:
    1. Here is another post describing how to do that.
    2. Here you can find some inspiration.

Now you can run pr from anywhere in your console and send a PR from your console 😄.

You can find a repository where everything is set up here.

Remember that the lane won’t work in your pc for that repository, given you don’t have a valid PAT in the .env file.


Use FastLane to create PRs | manu.show
Share: X (Twitter) LinkedIn