Skip to content

Commit 134a416

Browse files
committed
feat: init and rush with no test code 😉
0 parents  commit 134a416

File tree

17 files changed

+673
-0
lines changed

17 files changed

+673
-0
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
open-pull-requests-limit: 30
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main ]
20+
schedule:
21+
- cron: '32 8 * * 3'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'go' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v2
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v1
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v1
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
60+
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
64+
65+
#- run: |
66+
# make bootstrap
67+
# make release
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v1

.github/workflows/release.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- name: Set up Go
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: 1.19
23+
- name: Generate token
24+
id: generate_token
25+
uses: tibdex/github-app-token@v1
26+
with:
27+
app_id: ${{ secrets.APP_ID }}
28+
private_key: ${{ secrets.PRIVATE_KEY }}
29+
repository: sunggun-yu/homebrew-tap
30+
- name: Run GoReleaser
31+
uses: goreleaser/goreleaser-action@v2
32+
with:
33+
distribution: goreleaser
34+
version: latest
35+
args: release --rm-dist
36+
env:
37+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}

.github/workflows/test.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: test
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.19
20+
- name: Run go mod tidy
21+
run: go mod tidy
22+
- name: Run Test
23+
run: go test ./... -coverprofile=coverage.out -covermode=atomic
24+
- name: Upload coverage to Codecov
25+
run: bash <(curl -s https://codecov.io/bash)

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# IDEs
2+
.idea
3+
.vscode
4+
5+
# Binaries for programs and plugins
6+
*.exe
7+
*.exe~
8+
*.dll
9+
*.so
10+
*.dylib
11+
12+
# Test binary, built with `go test -c`
13+
*.test
14+
15+
# Output of the go coverage tool, specifically when used with LiteIDE
16+
*.out
17+
18+
bin/*
19+
!bin/.keep
20+
21+
dist/*
22+
!dist/.keep
23+
24+
# exclude generate secret file
25+
pkg/embeded/secrets
26+
27+
# Dependency directories (remove the comment below to include it)
28+
vendor/
29+
30+
# custom
31+
backup
32+
.history
33+
*.token
34+
*.pem

.goreleaser.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
4+
project_name: gh-app-access-token
5+
6+
before:
7+
hooks:
8+
- go mod tidy
9+
builds:
10+
- env:
11+
- CGO_ENABLED=0
12+
binary: "{{ .ProjectName }}"
13+
goos:
14+
- linux
15+
- windows
16+
- darwin
17+
goarch:
18+
- amd64
19+
- arm64
20+
goarm:
21+
- "6"
22+
- "7"
23+
ignore:
24+
- goos: windows
25+
goarch: arm64
26+
archives:
27+
- format: tar.gz
28+
wrap_in_directory: "true"
29+
format_overrides:
30+
- goos: windows
31+
format: zip
32+
checksum:
33+
name_template: 'checksums.txt'
34+
algorithm: sha256
35+
snapshot:
36+
name_template: "{{ incpatch .Version }}-next"
37+
changelog:
38+
sort: asc
39+
filters:
40+
exclude:
41+
- '^docs:'
42+
- '^test:'
43+
- "README"
44+
- "Merge pull request"
45+
- "Merge branch"
46+
47+
brews:
48+
- name: "gh-app-access-token"
49+
tap:
50+
owner: sunggun-yu
51+
name: homebrew-tap
52+
branch: main
53+
description: "Cli wrapper to set profile based environment variables for your command line execution"
54+
homepage: https://github.com/sunggun-yu/gh-app-access-token-cli
55+
folder: Formula
56+
download_strategy: CurlDownloadStrategy
57+
install: |
58+
bin.install "{{ .ProjectName }}"
59+
test: |
60+
system "#{bin}/{{ .ProjectName }} -v"

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Sunggun Yu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# gh-app-access-token-cli
2+
3+
Simple Cli tool for operating Github App Installation access token
4+
5+
## Installation
6+
7+
brew:
8+
9+
```bash
10+
brew install sunggun-yu/tap/gh-app-access-token
11+
```
12+
13+
go install:
14+
15+
```bash
16+
go install github.com/sunggun-yu/gh-app-access-token@<version>
17+
```
18+
19+
## Usage
20+
21+
### Generate a Github App access token
22+
23+
```bash
24+
# generate the Github App access token
25+
gh-app-access-token generate \
26+
--app-id [app-id] \
27+
--installation-id [installation-id] \
28+
--private-key [private-key-file-path]
29+
30+
# generate the Github App access token with file in HOME
31+
gh-app-access-token generate \
32+
--app-id [app-id] \
33+
--installation-id [installation-id] \
34+
--private-key $HOME/private-key.pem
35+
36+
# generate the Github App access token with file in HOME
37+
gh-app-access-token generate \
38+
--app-id [app-id] \
39+
--installation-id [installation-id] \
40+
--private-key ~/private-key.pem
41+
42+
# generate the Github App access token with text in private key file passed into stdin
43+
cat [private-key-file-path] | gh-app-access-token generate \
44+
--app-id [app-id] \
45+
--installation-id [installation-id] \
46+
--private-key -
47+
48+
# generate the Github App access token with private key text passed into stdin
49+
echo "private-key-text" | gh-app-access-token generate \
50+
--app-id [app-id] \
51+
--installation-id [installation-id] \
52+
--private-key -
53+
```
54+
55+
>⚠️ Note/Warning
56+
>
57+
> it keeps waiting(hang) if there is no stdin.
58+
59+
### Revoke the Github App access token
60+
61+
```bash
62+
# revoke token in argument
63+
gh-app-access-token-cli revoke [access token string]
64+
65+
# revoke the token passed into stdin
66+
cat [access-token-file] | gh-app-access-token-cli revoke -
67+
68+
# revoke the token passed into stdin
69+
echo "access-token-value" | gh-app-access-token-cli revoke -
70+
```
71+
72+
>⚠️ Note/Warning
73+
>
74+
> it keeps waiting(hang) if there is no stdin.

0 commit comments

Comments
 (0)