Skip to content

Instantly share code, notes, and snippets.

@rastandy
Created October 18, 2022 09:28
Show Gist options
  • Select an option

  • Save rastandy/2fa2c68172704a01f62a81595123532c to your computer and use it in GitHub Desktop.

Select an option

Save rastandy/2fa2c68172704a01f62a81595123532c to your computer and use it in GitHub Desktop.

Revisions

  1. rastandy created this gist Oct 18, 2022.
    9 changes: 9 additions & 0 deletions add-user-to-repo.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/bin/bash

    user=$1
    repo=$2
    permissions=$3

    echo "Adding ${user} to repo ${repo} with permissions ${permissions}..."
    gh api -XPUT repos/${repo}/collaborators/${user} -f permission=${permissions}
    echo "done."
    10 changes: 10 additions & 0 deletions add-user-to-repos.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/bash

    user=$1
    repos_file=$2
    permissions=$3

    for i in `cat ${repos_file}`
    do
    ./add-user-to-repo.sh ${user} ${i} ${permissions}
    done