Skip to content

Commit 52f27bb

Browse files
lindluniLink-
andauthored
Rewrite CLI in Go (#24)
* Rewrite CLI in Go Signed-off-by: Brett Logan <lindluni@github.com> * Update flag names and aliases to preserve backwards compatibility Signed-off-by: Brett Logan <lindluni@github.com> * Update image Signed-off-by: Brett Logan <lindluni@github.com> * Update deps Signed-off-by: Brett Logan <lindluni@github.com> * Adjust newlines Signed-off-by: Brett Logan <lindluni@github.com> * Reorder variable declaration Signed-off-by: Brett Logan <lindluni@github.com> * Add makefile * Remove funding * Add updated banner * Return empty array if are no installations * Default the jwt duration to 10 minutes if not provided or outside of boundaries * Fix malformatted token response * Fix README --------- Signed-off-by: Brett Logan <lindluni@github.com> Co-authored-by: Bassem Dghaidi <568794+Link-@users.noreply.github.com>
1 parent 2b1d1ac commit 52f27bb

21 files changed

+852
-1486
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/codeql.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: '41 2 * * 6'
12+
13+
concurrency:
14+
group: ${{ github.ref }}-${{ github.workflow }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
analyze:
19+
name: Analyze
20+
runs-on: 'ubuntu-latest'
21+
timeout-minutes: 15
22+
permissions:
23+
actions: read
24+
contents: read
25+
security-events: write
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v3
30+
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@v2
33+
with:
34+
languages: go
35+
36+
- name: Autobuild
37+
uses: github/codeql-action/autobuild@v2
38+
39+
- name: Perform CodeQL Analysis
40+
uses: github/codeql-action/analyze@v2
41+
with:
42+
category: "/language:go"

.github/workflows/linter.yml

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,25 @@
1-
---
2-
#################################
3-
#################################
4-
## Super Linter GitHub Actions ##
5-
#################################
6-
#################################
7-
name: Lint Code Base
1+
name: Lint
82

9-
#
10-
# Documentation:
11-
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
12-
#
13-
14-
#############################
15-
# Start the job on all push #
16-
#############################
173
on:
18-
push:
19-
branches-ignore: [master, main]
4+
pull_request:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.ref }}-${{ github.workflow }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
2014

21-
###############
22-
# Set the Job #
23-
###############
2415
jobs:
25-
build:
26-
# Name the Job
27-
name: Lint Code Base
28-
# Set the agent to run on
16+
lint:
17+
name: Lint
2918
runs-on: ubuntu-latest
30-
31-
##################
32-
# Load all steps #
33-
##################
3419
steps:
35-
##########################
36-
# Checkout the code base #
37-
##########################
3820
- name: Checkout Code
39-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
4022
with:
41-
# Full git history is needed to get a proper list of changed files within `super-linter`
4223
fetch-depth: 0
43-
44-
################################
45-
# Run Linter against code base #
46-
################################
47-
- name: Lint Code Base
48-
uses: github/super-linter@v4
49-
env:
50-
VALIDATE_ALL_CODEBASE: true
51-
DEFAULT_BRANCH: main
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Lint Code
25+
uses: golangci/golangci-lint-action@v3

.github/workflows/release.yml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
11
name: Release
2-
32
on:
4-
workflow_dispatch:
53
push:
6-
branches:
7-
- main
8-
paths:
9-
- 'gh-token'
4+
tags:
5+
- "v*"
6+
permissions:
7+
contents: write
108

119
jobs:
12-
Update:
13-
# The type of runner that the job will run on
10+
release:
1411
runs-on: ubuntu-latest
15-
1612
steps:
17-
- uses: actions/checkout@v2
18-
name: "Checkout repo"
19-
with:
20-
fetch-depth: 0
21-
token: ${{ secrets.GITHUB_TOKEN }}
22-
23-
- name: "Calculate new SHA256 hash"
24-
run: |
25-
new_sha="$(shasum -a 256 gh-token | sed -r 's/gh-token/ghtoken/g')"
26-
sed -r "s/echo \"[0-9a-f]{64} ghtoken\"/echo \"$new_sha\"/g" -i README.md
27-
28-
- name: "Commit and push updates"
29-
uses: EndBug/add-and-commit@a3adef035a1381dcf888c90b847240e2ddb9e008
30-
with:
31-
author_name: Link-
32-
author_email: '568794+Link-@users.noreply.github.com'
33-
message: 'Updating sha256 hash value'
34-
add: 'README.md'
13+
- uses: actions/checkout@v3
14+
- uses: cli/gh-extension-precompile@v1

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,11 @@ tags
6161
.keys
6262

6363
### Project files
64-
jwt
64+
jwt
65+
66+
# Generated files
67+
gh-token
68+
gh-token.exe
69+
70+
# Test app keys
71+
*.pem

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1111
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1212
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1313
PERFORMANCE OF THIS SOFTWARE.
14+

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Makefile with the following targets:
2+
# all: build the project
3+
# clean: remove all build artifacts
4+
# build: build the project
5+
# help: print this help message
6+
# .PHONY: mark targets as phony
7+
# .DEFAULT_GOAL: set the default goal to all
8+
9+
# Set the default goal to all
10+
.DEFAULT_GOAL := all
11+
PROJECT_NAME := "gh-token"
12+
13+
# Mark targets as phony
14+
.PHONY: all clean build
15+
16+
# Build the project
17+
all: clean build
18+
19+
# Remove all build artifacts
20+
clean:
21+
rm gh-token
22+
23+
# Build the project
24+
build:
25+
go build -o gh-token .

0 commit comments

Comments
 (0)