Skip to content

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Nov 12, 2019
1 parent 1c877d7 commit 2b1acf4
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

SRC=main.go
BIN=github-team-ssh-keys
VERSION=$(shell cat VERSION)

all:
GO111MODULE=on go build -o $(BIN) $(SRC)

run:
GO111MODULE=on go run ${SRC} --github-org epitech --github-team sysadmin

release:
GO111MODULE=on go build -o $(BIN)_$(VERSION)_linux-amd64 $(SRC)

clean:
rm -f $(BIN)
60 changes: 53 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ Sync public ssh keys to `~/.ssh/authorized_keys`, based on Github teams membersh

## Install

```
go get github.com/samber/github-team-ssh-keys
```bash
$ go get github.com/samber/github-team-ssh-keys
```

or

```
curl -o /usr/local/bin/github-team-ssh-keys https://github.com/samber/github-team-ssh-keys/releases/download/v0.1.0/github-team-ssh-keys_v0.1.0_linux-amd64
```bash
$ curl -o /usr/local/bin/github-team-ssh-keys \
https://github.com/samber/github-team-ssh-keys/releases/download/v0.2.0/github-team-ssh-keys_v0.2.0_linux-amd64
$ chmod +x /usr/local/bin/github-team-ssh-keys
```

### Sync with crontask
### Sync using a crontask

```
crontab -e
```bash
$ crontab -e
```

Then:
Expand All @@ -29,10 +31,54 @@ Then:

## Usage

### Simple user

```bash
$ github-team-ssh-keys --github-user samber

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhDlAK8ewcwCTOv6xZHAAJK36QJ1ljJyn9/GiDTHE9aAREQdTtpPGrLvCxuqy3SZl/hvwSpNFjz0YH0sYvfQvBOTCogNo9o1FKcJaA9jOxPktRb2pObDA0+e2KIbyx3JR4hg63uP+p7awP8uKoRE+O8G6aTmv33mwqsl8ZOMVPo+qEkWniVCc5m7U1a/jIZj2JgFBa7Dhjnnr7RKlUWnmc0VhKQLwiOnyzpSMV2WBlOBrBnUAz60F2exTdX7zgULMHxyRSmL4xe/+BUHEUf9T41AEdWtcUx0iS7m/wGUvHKKokkz1zCkUGFy+Kq3rviH9dWYYt4KiHPm2/6DgKNua/ samber@github-team-ssh-key
```

### All members of an organizations

```bash
$ github-team-ssh-keys --github-token XXXXXXXXXXXXXXX \
--github-org epitech

[...]
```

### All members of an organizations being part of teams "root" and "sre"

```bash
$ github-team-ssh-keys --github-token XXXXXXXXXXXXXXX \
--github-org epitech \
--github-team root \
--github-team sre

[...]
```

### All members of an organizations excluding me ;)

```bash
$ github-team-ssh-keys --github-token XXXXXXXXXXXXXXX \
--github-org epitech \
--exclude-github-user samber

[...]
```

## Contribute

```bash
$ make run
```

```bash
$ make release
```

## License

[MIT license](./LICENSE)
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2.0
7 changes: 5 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ func getUserSSHKeys(username string) []string {
}

func output(sshKeys []string) {
fmt.Println(strings.Join(sshKeys, "\n\n"))
if len(sshKeys) > 0 {
fmt.Println("#\n# Generated with https://github.com/samber/github-team-ssh-keys\n#\n")
fmt.Println(strings.Join(sshKeys, "\n\n"))
}
}

func checkFlags() {
Expand All @@ -159,7 +162,7 @@ func checkFlags() {
}

func main() {
kingpin.Version("0.1.0")
kingpin.Version("0.2.0")
kingpin.Parse()
checkFlags()

Expand Down

0 comments on commit 2b1acf4

Please sign in to comment.