Skip to content

Instantly share code, notes, and snippets.

@JanTvrdik
Last active June 6, 2016 19:25

Revisions

  1. JanTvrdik revised this gist May 13, 2016. 1 changed file with 7 additions and 12 deletions.
    19 changes: 7 additions & 12 deletions add_pull_request_to_issue_github.sh
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,9 @@
    current_branch="$(git symbolic-ref HEAD 2>/dev/null)" || current_branch="(unknown)"
    current_branch=${current_branch##refs/heads/}

    github_username="JanTvrdik"
    github_token="..."

    if [[ $current_branch = "(unknown)" ]]
    then
    echo "Unable to determine current branch!"
    @@ -21,18 +24,10 @@ read project
    echo "Issue number:"
    read issue

    echo "Base commit / branch:"
    echo "Base commit / branch (usually master):"
    read base

    echo "GitHub username:"
    read username

    echo "GitHub password:"
    read password

    curl \
    -d "pull[base]=$base" \
    -d "pull[head]=$owner:$current_branch" \
    -d "pull[issue]=$issue" \
    -u "$username:$password" \
    https://github.com/api/v2/json/pulls/$owner/$project
    -d "{ \"base\": \"$base\", \"head\": \"$github_username:$current_branch\", \"issue\": \"$issue\"}" \
    -u "$github_token:x-oauth-basic" \
    https://api.github.com/repos/$owner/$project/pulls
  2. JanTvrdik revised this gist Jun 14, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add_pull_request_to_issue_github.sh
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ then
    fi

    echo "Project owner:"
    echo " (the guy or the company which must to accept your pull request)"
    echo " (the guy or the company which must accept your pull request)"
    echo " (https://github.com/symfony/TwigBundle -> symfony)"
    read owner

  3. JanTvrdik revised this gist Jun 14, 2012. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions add_pull_request_to_issue_github.sh
    Original file line number Diff line number Diff line change
    @@ -9,8 +9,14 @@ then
    exit 1
    fi

    owner="..." # project owner
    project="..." # project name
    echo "Project owner:"
    echo " (the guy or the company which must to accept your pull request)"
    echo " (https://github.com/symfony/TwigBundle -> symfony)"
    read owner

    echo "Project name:"
    echo " (https://github.com/symfony/TwigBundle -> TwigBundle)"
    read project

    echo "Issue number:"
    read issue
  4. JanTvrdik revised this gist Jun 14, 2012. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions add_pull_request_to_issue_github.sh
    Original file line number Diff line number Diff line change
    @@ -9,8 +9,8 @@ then
    exit 1
    fi

    company="clevisaci"
    project="tripilot"
    owner="..." # project owner
    project="..." # project name

    echo "Issue number:"
    read issue
    @@ -26,7 +26,7 @@ read password

    curl \
    -d "pull[base]=$base" \
    -d "pull[head]=$company:$current_branch" \
    -d "pull[head]=$owner:$current_branch" \
    -d "pull[issue]=$issue" \
    -u "$username:$password" \
    https://github.com/api/v2/json/pulls/$company/$project
    https://github.com/api/v2/json/pulls/$owner/$project
  5. JanTvrdik revised this gist Apr 20, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add_pull_request_to_issue_github.sh
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ current_branch=${current_branch##refs/heads/}

    if [[ $current_branch = "(unknown)" ]]
    then
    echo "Nepodařilo se zjistit aktuální větev!"
    echo "Unable to determine current branch!"
    exit 1
    fi

  6. JanTvrdik revised this gist Apr 20, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add_pull_request_to_issue_github.sh
    Original file line number Diff line number Diff line change
    @@ -28,5 +28,5 @@ curl \
    -d "pull[base]=$base" \
    -d "pull[head]=$company:$current_branch" \
    -d "pull[issue]=$issue" \
    -u '$username:$password' \
    -u "$username:$password" \
    https://github.com/api/v2/json/pulls/$company/$project
  7. JanTvrdik revised this gist Apr 20, 2012. 1 changed file with 32 additions and 4 deletions.
    36 changes: 32 additions & 4 deletions add_pull_request_to_issue_github.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,32 @@
    curl -d "pull[base]={branch_in_project_to_pull_to}" -d "pull[head]={your_github_username}:{branch_you_want_to_merge}" \
    -d "pull[issue]={issue_number}" \
    -u '{your_github_username}:{your_github_password}' \
    https://github.com/api/v2/json/pulls/{github_username_you_are_requesting_the_pull_from}/{project_you want_to_submit_pull_to}
    #!/bin/bash

    current_branch="$(git symbolic-ref HEAD 2>/dev/null)" || current_branch="(unknown)"
    current_branch=${current_branch##refs/heads/}

    if [[ $current_branch = "(unknown)" ]]
    then
    echo "Nepodařilo se zjistit aktuální větev!"
    exit 1
    fi

    company="clevisaci"
    project="tripilot"

    echo "Issue number:"
    read issue

    echo "Base commit / branch:"
    read base

    echo "GitHub username:"
    read username

    echo "GitHub password:"
    read password

    curl \
    -d "pull[base]=$base" \
    -d "pull[head]=$company:$current_branch" \
    -d "pull[issue]=$issue" \
    -u '$username:$password' \
    https://github.com/api/v2/json/pulls/$company/$project
  8. @sethvargo sethvargo created this gist Jul 14, 2011.
    4 changes: 4 additions & 0 deletions add_pull_request_to_issue_github.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    curl -d "pull[base]={branch_in_project_to_pull_to}" -d "pull[head]={your_github_username}:{branch_you_want_to_merge}" \
    -d "pull[issue]={issue_number}" \
    -u '{your_github_username}:{your_github_password}' \
    https://github.com/api/v2/json/pulls/{github_username_you_are_requesting_the_pull_from}/{project_you want_to_submit_pull_to}