Skip to content

Handle Basic Bitbucket Repo Actions using with Command Line or Simple Ruby Script

Notifications You must be signed in to change notification settings

singhdurgesh/bitbucket_scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Handle Basic Bitbucket Repo Actions using REST APIs with Command Line or Simple Ruby Script

Description

Bitbucket provides its rest apis. We will be using it for simple pull requests actions like

  • Create a Pull Request
    • With Normal Description
    • Markdown Formatted Description Reference
  • Merge a Pull Request
  • Decline a Pull Request
  • Fetch details about a Pull Request
  • Fetch all active Pull Requests for a given Repository

NOTE: We will be authenticating the APIs with Basic Auth. Here Bitbucket username will be used as username and for password you have to create an App Password with required permissions. Follow the steps provided here to generate an App Password.


Integration

  1. Clone this Repository

    git clone [email protected]:durgesh_snigh/bitbucket_scripts.git

  2. Add application.yml file to add username and app password

    cp config/application.ci.yml config/application.yml

  3. Install Ruby with your current
    • Install HTTParty Library

How to Use

With Ruby Scripts

  • Refer create_pull_request.rb
  • Run the script with follwing command from the terminal

    ruby lib/scripts/create_pull_request.rb

With IRB

  • Open IRB console with irb command in Linux Terminals in the Current Repo
  • load the application file

    load config/application.rb

  • Initialize a repository

    repository = Repository.new(name: 'bitbucket_scripts', project_name: 'durgesh_snigh')

  • Initialize a pull request

    pull_request = PullRequest.new(repository: repository, pull_request_id: <Pull Request id>)

  • Fetch the pull request details

    details = pull_request.fetch_pull_request_details puts details

  • Refer [lib/scripts/create_pull_request.rb](TODO: Add link to the file) for more functionalities

Resources

About

Handle Basic Bitbucket Repo Actions using with Command Line or Simple Ruby Script

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published