Compare commits
10 Commits
v1.0.3
...
v1.0.4-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d88f49218f | ||
|
|
281c73efa0 | ||
|
|
c16b05447b | ||
|
|
a9d75d16fb | ||
|
|
71fc548b2d | ||
|
|
24022671c7 | ||
|
|
88a1bc276b | ||
|
|
27d4a4c8f5 | ||
|
|
ed34fad2e5 | ||
|
|
bf7745edd0 |
6
.github/workflows/canary.yaml
vendored
6
.github/workflows/canary.yaml
vendored
@@ -38,12 +38,12 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- name: Install extension
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPO_WRITE_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: gh extensions install actions/gh-actions-cache
|
||||
- name: List Command
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPO_WRITE_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
cache_found=$(gh actions-cache list --key $CacheKey --limit 100 --branch $GITHUB_REF --order desc --sort created-at | grep $CacheKey)
|
||||
echo $cache_found
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
- name: Delete Command
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPO_WRITE_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
cache_delete=$(gh actions-cache delete $CacheKey --branch $GITHUB_REF --confirm | grep "Deleted 1 cache entry with key")
|
||||
echo $cache_delete
|
||||
|
||||
7
.github/workflows/e2e_test.yml
vendored
7
.github/workflows/e2e_test.yml
vendored
@@ -2,7 +2,10 @@ name: E2E Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -43,6 +46,8 @@ jobs:
|
||||
restore-keys: |
|
||||
go-${{ runner.os }}-
|
||||
- name: Build the project
|
||||
env:
|
||||
CGO_ENABLED: 0
|
||||
run: go build
|
||||
- name: Install extension
|
||||
env:
|
||||
|
||||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -37,5 +37,7 @@ jobs:
|
||||
GH_TOKEN: dummy-token-to-facilitate-rest-client
|
||||
|
||||
- uses: cli/gh-extension-precompile@v1
|
||||
env:
|
||||
CGO_ENABLED: 0
|
||||
with:
|
||||
go_version: "1.18"
|
||||
go_version: "1.18"
|
||||
|
||||
23
README.md
23
README.md
@@ -8,13 +8,13 @@ It also allows deleting a corrupt, incomplete or dangling cache. A cache can be
|
||||
|
||||
This extension builds on top of [cache management](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches) capabilities exposed by GitHub [APIs](https://docs.github.com/en/rest/actions/cache).
|
||||
|
||||
**Note:** This extension currently supports github.com only, GitHub Enterprise Server is not supported currently.
|
||||
**Note:** This extension only supports github.com and GitHub Enterprise Server 3.7 & above.
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install the `gh` CLI - see the [installation](https://github.com/cli/cli#installation)
|
||||
|
||||
_Installation requires a minimum version (2.0.0) of the the GitHub CLI that supports extensions._
|
||||
_Installation requires a minimum version (2.0.0) of the GitHub CLI that supports extensions._
|
||||
|
||||
2. Install this extension:
|
||||
|
||||
@@ -97,6 +97,25 @@ EXAMPLES:
|
||||
|
||||
> ℹ️ There could be multiple caches in a repo with same key. This can happen when different caches with same key have been created for different branches. it may also happen if the `version` property of the cache is different which usually means that cache with same key was created for different OS or with different [paths](https://github.com/actions/cache#inputs).
|
||||
|
||||
## FAQs
|
||||
|
||||
### How the current repository is selected?
|
||||
|
||||
This extension currently uses the `go-gh` module's [`CurrentRepository` function](https://github.com/actions/gh-actions-cache/blob/d3293b69e1c5bc17686d815ab2c64618618c95df/internal/utils.go#L26) to determine the current repo. This function returns the first element of the list returned by the `git.Remotes()` internal function, which [sorts remotes such that `upstream` precedes `github`, which precedes `origin`](https://github.com/cli/go-gh/blob/c2fc965daac88a8a38dd8af02f236095b5dd48f1/internal/git/remote.go#L30). As such, if an `upstream` remote is present, this extension's default behavior is to return its caches.
|
||||
|
||||
User's input `--repo <owner>/<name>` will override any current git repository and extension will fetch caches for the same.
|
||||
|
||||
### How to remove trimming in results
|
||||
|
||||
We support a table printer that allows users to pipe output for further processing. If we want to list down certain columns without trimming then just selecting the column number in the below command will work.
|
||||
|
||||
`gh actions-cache list -R <owner>/<repo_name> | cut -f 1,2,3`
|
||||
|
||||
This will print columns 1,2 and 3 without any trimming.
|
||||
|
||||
### Delete all caches for a branch
|
||||
|
||||
Please refers to this doc - [Force deleting cache entries](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries)
|
||||
|
||||
## Contributing
|
||||
If anything feels off, or if you feel that some functionality is missing, please check out the [contributing page](CONTRIBUTING.md). There you will find instructions for sharing your feedback, building the tool locally, and submitting pull requests to the project.
|
||||
|
||||
@@ -62,8 +62,8 @@ func NewCmdDelete() *cobra.Command {
|
||||
}
|
||||
err = survey.AskOne(prompt, &choice)
|
||||
if err != nil {
|
||||
fmt.Println("Error occured while taking input from user while trying to delete cache")
|
||||
return types.HandledError{Message: "Error occured while taking input from user while trying to delete cache.", InnerError: err}
|
||||
fmt.Println("Error occurred while taking input from user while trying to delete cache")
|
||||
return types.HandledError{Message: "Error occurred while taking input from user while trying to delete cache.", InnerError: err}
|
||||
}
|
||||
|
||||
f.Confirm = choice == "Delete"
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/actions/gh-actions-cache/internal"
|
||||
@@ -19,8 +16,7 @@ func TestDeleteWithIncorrectArguments(t *testing.T) {
|
||||
cmd.SetArgs([]string{})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, err, fmt.Errorf("accepts 1 arg(s), received 0"))
|
||||
assert.ErrorContains(t, err, "accepts 1 arg(s), received 0")
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -31,8 +27,7 @@ func TestDeleteWithIncorrectRepo(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo/123/123", "cacheName"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, err, fmt.Errorf("expected the \"[HOST/]OWNER/REPO\" format, got \"testOrg/testRepo/123/123\""))
|
||||
assert.ErrorContains(t, err, "expected the \"[HOST/]OWNER/REPO\" format, got \"testOrg/testRepo/123/123\"")
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -52,11 +47,11 @@ func TestDeleteWithIncorrectRepoForDeleteCaches(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo", "cacheName"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
var customError types.HandledError
|
||||
errors.As(err, &customError)
|
||||
assert.Equal(t, customError.Message, "The given repo does not exist.")
|
||||
if assert.ErrorAs(t, err, &customError) {
|
||||
assert.Equal(t, "The given repo does not exist.", customError.Message)
|
||||
}
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
func TestDeleteSuccessWithConfirmFlagProvided(t *testing.T) {
|
||||
@@ -85,7 +80,7 @@ func TestDeleteSuccessWithConfirmFlagProvided(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo", "2022-06-29T13:33:49", "--confirm"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -116,7 +111,7 @@ func TestDeleteFailureWhileTakingUserInput(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo", "2022-06-29T13:33:49"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Error(t, err)
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -135,13 +130,10 @@ func TestDeleteWithUnauthorizedRequestForDeleteCaches(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo", "cacheKey", "--confirm"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, reflect.TypeOf(err), reflect.TypeOf(types.HandledError{}))
|
||||
|
||||
var customError types.HandledError
|
||||
errors.As(err, &customError)
|
||||
assert.Equal(t, customError.Message, "Must have admin rights to Repository.")
|
||||
|
||||
if assert.ErrorAs(t, err, &customError) {
|
||||
assert.Equal(t, "Must have admin rights to Repository.", customError.Message)
|
||||
}
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -160,12 +152,9 @@ func TestDeleteWithInternalServerErrorForDeleteCaches(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo", "cacheKey", "--confirm"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, reflect.TypeOf(err), reflect.TypeOf(types.HandledError{}))
|
||||
|
||||
var customError types.HandledError
|
||||
errors.As(err, &customError)
|
||||
assert.Equal(t, customError.Message, "We could not process your request due to internal error.")
|
||||
|
||||
if assert.ErrorAs(t, err, &customError) {
|
||||
assert.Equal(t, "We could not process your request due to internal error.", customError.Message)
|
||||
}
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/actions/gh-actions-cache/internal"
|
||||
@@ -21,8 +17,7 @@ func TestListWithIncorrectArguments(t *testing.T) {
|
||||
cmd.SetArgs([]string{"keyValue"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, err, fmt.Errorf("Invalid argument(s). Expected 0 received 1"))
|
||||
assert.ErrorContains(t, err, "Invalid argument(s). Expected 0 received 1")
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -33,8 +28,7 @@ func TestListWithIncorrectRepo(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo/123/123"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, err, fmt.Errorf("expected the \"[HOST/]OWNER/REPO\" format, got \"testOrg/testRepo/123/123\""))
|
||||
assert.ErrorContains(t, err, "expected the \"[HOST/]OWNER/REPO\" format, got \"testOrg/testRepo/123/123\"")
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -45,8 +39,7 @@ func TestListWithNegativeLimit(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--limit", "-1", "--repo", "testOrg/testRepo"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, err, fmt.Errorf("-1 is not a valid integer value for limit flag. Allowed values: 1-100"))
|
||||
assert.ErrorContains(t, err, "-1 is not a valid integer value for limit flag. Allowed values: 1-100")
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -57,8 +50,7 @@ func TestListWithIncorrectLimit(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--limit", "101", "--repo", "testOrg/testRepo"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, err, fmt.Errorf("101 is not a valid integer value for limit flag. Allowed values: 1-100"))
|
||||
assert.ErrorContains(t, err, "101 is not a valid integer value for limit flag. Allowed values: 1-100")
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -69,8 +61,7 @@ func TestListLimitShorthandUsingIncorrectLimit(t *testing.T) {
|
||||
cmd.SetArgs([]string{"-L", "102", "--repo", "testOrg/testRepo"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, err, fmt.Errorf("102 is not a valid integer value for limit flag. Allowed values: 1-100"))
|
||||
assert.ErrorContains(t, err, "102 is not a valid integer value for limit flag. Allowed values: 1-100")
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -81,8 +72,7 @@ func TestListWithIncorrectOrder(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--order", "incorrectOrderValue", "--repo", "testOrg/testRepo"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, err, fmt.Errorf("incorrectOrderValue is not a valid value for order flag. Allowed values: asc/desc"))
|
||||
assert.ErrorContains(t, err, "incorrectOrderValue is not a valid value for order flag. Allowed values: asc/desc")
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -93,8 +83,7 @@ func TestListWithIncorrectSort(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--sort", "incorrectSortValue", "--repo", "testOrg/testRepo"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, err, fmt.Errorf("incorrectSortValue is not a valid value for sort flag. Allowed values: last-used/size/created-at"))
|
||||
assert.ErrorContains(t, err, "incorrectSortValue is not a valid value for sort flag. Allowed values: last-used/size/created-at")
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -121,13 +110,10 @@ func TestListWithIncorrectRepoForListCaches(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, reflect.TypeOf(err), reflect.TypeOf(types.HandledError{}))
|
||||
|
||||
var customError types.HandledError
|
||||
errors.As(err, &customError)
|
||||
assert.Equal(t, customError.Message, "The given repo does not exist.")
|
||||
|
||||
if assert.ErrorAs(t, err, &customError) {
|
||||
assert.Equal(t, "The given repo does not exist.", customError.Message)
|
||||
}
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -154,13 +140,10 @@ func TestListWithUnauthorizedRequestForListCaches(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, reflect.TypeOf(err), reflect.TypeOf(types.HandledError{}))
|
||||
|
||||
var customError types.HandledError
|
||||
errors.As(err, &customError)
|
||||
assert.Equal(t, customError.Message, "Must have admin rights to Repository.")
|
||||
|
||||
if assert.ErrorAs(t, err, &customError) {
|
||||
assert.Equal(t, "Must have admin rights to Repository.", customError.Message)
|
||||
}
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -187,13 +170,10 @@ func TestListWithInternalServerErrorForListCaches(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, reflect.TypeOf(err), reflect.TypeOf(types.HandledError{}))
|
||||
|
||||
var customError types.HandledError
|
||||
errors.As(err, &customError)
|
||||
assert.Equal(t, customError.Message, "We could not process your request due to internal error.")
|
||||
|
||||
if assert.ErrorAs(t, err, &customError) {
|
||||
assert.Equal(t, "We could not process your request due to internal error.", customError.Message)
|
||||
}
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -229,6 +209,6 @@ func TestListSuccess(t *testing.T) {
|
||||
cmd.SetArgs([]string{"--repo", "testOrg/testRepo"})
|
||||
err := cmd.Execute()
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
31
go.mod
31
go.mod
@@ -5,38 +5,41 @@ go 1.18
|
||||
require (
|
||||
github.com/AlecAivazis/survey/v2 v2.3.5
|
||||
github.com/TwiN/go-color v1.1.0
|
||||
github.com/cli/go-gh v0.1.0
|
||||
github.com/cli/go-gh v1.2.1
|
||||
github.com/nleeper/goment v1.4.4
|
||||
github.com/spf13/cobra v1.5.0
|
||||
github.com/stretchr/testify v1.8.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/MakeNowJust/heredoc v1.0.0 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/termenv v0.15.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/cli/safeexec v1.0.0 // indirect
|
||||
github.com/cli/shurcooL-graphql v0.0.1 // indirect
|
||||
github.com/cli/safeexec v1.0.1 // indirect
|
||||
github.com/cli/shurcooL-graphql v0.0.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
|
||||
github.com/henvic/httpretty v0.0.6 // indirect
|
||||
github.com/henvic/httpretty v0.1.2 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/mattn/go-colorable v0.1.2 // indirect
|
||||
github.com/mattn/go-isatty v0.0.8 // indirect
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/tkuchiki/go-timezone v0.2.0 // indirect
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
|
||||
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect
|
||||
golang.org/x/text v0.3.6 // indirect
|
||||
golang.org/x/net v0.11.0 // indirect
|
||||
golang.org/x/sys v0.9.0 // indirect
|
||||
golang.org/x/term v0.9.0 // indirect
|
||||
golang.org/x/text v0.10.0 // indirect
|
||||
gopkg.in/h2non/gock.v1 v1.1.2
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
82
go.sum
82
go.sum
@@ -1,17 +1,18 @@
|
||||
github.com/AlecAivazis/survey/v2 v2.3.5 h1:A8cYupsAZkjaUmhtTYv3sSqc7LO5mp1XDfqe5E/9wRQ=
|
||||
github.com/AlecAivazis/survey/v2 v2.3.5/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI=
|
||||
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
|
||||
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
|
||||
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
|
||||
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
|
||||
github.com/TwiN/go-color v1.1.0 h1:yhLAHgjp2iAxmNjDiVb6Z073NE65yoaPlcki1Q22yyQ=
|
||||
github.com/TwiN/go-color v1.1.0/go.mod h1:aKVf4e1mD4ai2FtPifkDPP5iyoCwiK08YGzGwerjKo0=
|
||||
github.com/cli/go-gh v0.1.0 h1:kMqFmC3ECBrV2UKzlOHjNOTTchExVc5tjNHtCqk/zYk=
|
||||
github.com/cli/go-gh v0.1.0/go.mod h1:eTGWl99EMZ+3Iau5C6dHyGAJRRia65MtdBtuhWc+84o=
|
||||
github.com/cli/safeexec v1.0.0 h1:0VngyaIyqACHdcMNWfo6+KdUYnqEr2Sg+bSP1pdF+dI=
|
||||
github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=
|
||||
github.com/cli/shurcooL-graphql v0.0.1 h1:/9J3t9O6p1B8zdBBtQighq5g7DQRItBwuwGh3SocsKM=
|
||||
github.com/cli/shurcooL-graphql v0.0.1/go.mod h1:U7gCSuMZP/Qy7kbqkk5PrqXEeDgtfG5K+W+u8weorps=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
||||
github.com/cli/go-gh v1.2.1 h1:xFrjejSsgPiwXFP6VYynKWwxLQcNJy3Twbu82ZDlR/o=
|
||||
github.com/cli/go-gh v1.2.1/go.mod h1:Jxk8X+TCO4Ui/GarwY9tByWm/8zp4jJktzVZNlTW5VM=
|
||||
github.com/cli/safeexec v1.0.1 h1:e/C79PbXF4yYTN/wauC4tviMxEV13BwljGj0N9j+N00=
|
||||
github.com/cli/safeexec v1.0.1/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=
|
||||
github.com/cli/shurcooL-graphql v0.0.3 h1:CtpPxyGDs136/+ZeyAfUKYmcQBjDlq5aqnrDCW5Ghh8=
|
||||
github.com/cli/shurcooL-graphql v0.0.3/go.mod h1:tlrLmw/n5Q/+4qSvosT+9/W5zc8ZMjnJeYBxSdb4nWA=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
|
||||
@@ -21,8 +22,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
|
||||
github.com/henvic/httpretty v0.0.6 h1:JdzGzKZBajBfnvlMALXXMVQWxWMF/ofTy8C3/OSUTxs=
|
||||
github.com/henvic/httpretty v0.0.6/go.mod h1:X38wLjWXHkXT7r2+uK8LjCMne9rsuNaBLJ+5cU2/Pmo=
|
||||
github.com/henvic/httpretty v0.1.2 h1:EQo556sO0xeXAjP10eB+BZARMuvkdGqtfeS4Ntjvkiw=
|
||||
github.com/henvic/httpretty v0.1.2/go.mod h1:ViEsly7wgdugYtymX54pYp6Vv2wqZmNHayJ6q8tlKCc=
|
||||
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
|
||||
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
@@ -32,22 +33,35 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:C
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
|
||||
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
|
||||
github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs=
|
||||
github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ=
|
||||
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
|
||||
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
||||
github.com/nleeper/goment v1.4.4 h1:GlMTpxvhueljArSunzYjN9Ri4SOmpn0Vh2hg2z/IIl8=
|
||||
github.com/nleeper/goment v1.4.4/go.mod h1:zDl5bAyDhqxwQKAvkSXMRLOdCowrdZz53ofRJc4VhTo=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
||||
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
|
||||
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
|
||||
@@ -63,21 +77,49 @@ github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e h1:Buzhfgf
|
||||
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e/go.mod h1:/Tnicc6m/lsJE0irFMA0LfIwTBo4QP7A8IfyIv4zZKI=
|
||||
github.com/tkuchiki/go-timezone v0.2.0 h1:yyZVHtQRVZ+wvlte5HXvSpBkR0dPYnPEIgq9qqAqltk=
|
||||
github.com/tkuchiki/go-timezone v0.2.0/go.mod h1:b1Ean9v2UXtxSq4TZF0i/TU9NuoWa9hOzOKoGCV2zqY=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220923203811-8be639271d50/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU=
|
||||
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc=
|
||||
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
|
||||
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w=
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28=
|
||||
golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
|
||||
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
|
||||
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
|
||||
|
||||
@@ -11,45 +11,44 @@ func TestGetRepo_IncorrectRepoString(t *testing.T) {
|
||||
r := "testOrg/testRepo/123/123"
|
||||
repo, err := GetRepo(r)
|
||||
|
||||
assert.Error(t, err)
|
||||
assert.ErrorContains(t, err, fmt.Sprintf("expected the \"[HOST/]OWNER/REPO\" format, got \"%s\"", r))
|
||||
assert.Nil(t, repo)
|
||||
assert.Equal(t, err.Error(), fmt.Sprintf("expected the \"[HOST/]OWNER/REPO\" format, got \"%s\"", r))
|
||||
}
|
||||
|
||||
func TestGetRepo_CorrectRepoString(t *testing.T) {
|
||||
r := "testOrg/testRepo"
|
||||
repo, err := GetRepo(r)
|
||||
|
||||
assert.NotNil(t, repo)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, repo.Host(), "github.com")
|
||||
assert.Equal(t, repo.Owner(), "testOrg")
|
||||
assert.Equal(t, repo.Name(), "testRepo")
|
||||
assert.NoError(t, err)
|
||||
if assert.NotNil(t, repo) {
|
||||
assert.Equal(t, "github.com", repo.Host())
|
||||
assert.Equal(t, "testOrg", repo.Owner())
|
||||
assert.Equal(t, "testRepo", repo.Name())
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetRepo_CorrectRepoStringWithCustomHost(t *testing.T) {
|
||||
r := "api.testEnterprise.com/testOrg/testRepo"
|
||||
repo, err := GetRepo(r)
|
||||
|
||||
assert.NotNil(t, repo)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, repo.Host(), "api.testEnterprise.com")
|
||||
assert.Equal(t, repo.Owner(), "testOrg")
|
||||
assert.Equal(t, repo.Name(), "testRepo")
|
||||
assert.NoError(t, err)
|
||||
if assert.NotNil(t, repo) {
|
||||
assert.Equal(t, "api.testEnterprise.com", repo.Host())
|
||||
assert.Equal(t, "testOrg", repo.Owner())
|
||||
assert.Equal(t, "testRepo", repo.Name())
|
||||
}
|
||||
}
|
||||
|
||||
func TestFormatCacheSize_MB(t *testing.T) {
|
||||
cacheSizeInBytes := 1024 * 1024 * 1.5
|
||||
cacheSizeDetailString := FormatCacheSize(cacheSizeInBytes)
|
||||
|
||||
assert.NotNil(t, cacheSizeDetailString)
|
||||
assert.Equal(t, cacheSizeDetailString, "1.50 MB")
|
||||
assert.Equal(t, "1.50 MB", cacheSizeDetailString)
|
||||
}
|
||||
|
||||
func TestFormatCacheSize_GB(t *testing.T) {
|
||||
cacheSizeInBytes := 1024 * 1024 * 1024 * 1.5
|
||||
cacheSizeDetailString := FormatCacheSize(cacheSizeInBytes)
|
||||
|
||||
assert.NotNil(t, cacheSizeDetailString)
|
||||
assert.Equal(t, cacheSizeDetailString, "1.50 GB")
|
||||
assert.Equal(t, "1.50 GB", cacheSizeDetailString)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
@@ -9,6 +8,7 @@ import (
|
||||
"github.com/actions/gh-actions-cache/types"
|
||||
"github.com/cli/go-gh/pkg/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/h2non/gock.v1"
|
||||
)
|
||||
|
||||
@@ -27,14 +27,15 @@ func TestGetCacheUsage_CorrectRepo(t *testing.T) {
|
||||
}`)
|
||||
|
||||
repo, err := internal.GetRepo("testOrg/testRepo")
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
artifactCache, err := NewArtifactCache(repo, "list", VERSION)
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, artifactCache)
|
||||
totalCacheSize, err := artifactCache.GetCacheUsage()
|
||||
|
||||
assert.Equal(t, totalCacheSize, float64(291205))
|
||||
assert.Nil(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, float64(291205), totalCacheSize)
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -50,18 +51,18 @@ func TestGetCacheUsage_IncorrectRepo(t *testing.T) {
|
||||
}`)
|
||||
|
||||
repo, err := internal.GetRepo("testOrg/wrongRepo")
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
artifactCache, err := NewArtifactCache(repo, "list", VERSION)
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, artifactCache)
|
||||
totalCacheSize, err := artifactCache.GetCacheUsage()
|
||||
var httpError api.HTTPError
|
||||
errors.As(err, &httpError)
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, httpError.StatusCode, 404)
|
||||
assert.Equal(t, httpError.Message, "Not Found")
|
||||
assert.Equal(t, totalCacheSize, float64(-1))
|
||||
if assert.ErrorAs(t, err, &httpError) {
|
||||
assert.Equal(t, 404, httpError.StatusCode)
|
||||
assert.Equal(t, "Not Found", httpError.Message)
|
||||
}
|
||||
assert.Equal(t, float64(-1), totalCacheSize)
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -86,21 +87,23 @@ func TestListCaches_Success(t *testing.T) {
|
||||
}`)
|
||||
|
||||
repo, err := internal.GetRepo("testOrg/testRepo")
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
f := types.ListOptions{BaseOptions: types.BaseOptions{Repo: "testOrg/testRepo"}, Limit: 30}
|
||||
queryParams := url.Values{}
|
||||
f.GenerateQueryParams(queryParams)
|
||||
|
||||
artifactCache, err := NewArtifactCache(repo, "list", VERSION)
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, artifactCache)
|
||||
listCacheResponse, err := artifactCache.ListCaches(queryParams)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.NotNil(t, listCacheResponse)
|
||||
assert.Equal(t, listCacheResponse.TotalCount, 1)
|
||||
assert.Equal(t, len(listCacheResponse.ActionsCaches), 1)
|
||||
assert.Equal(t, listCacheResponse.ActionsCaches[0].Id, 29)
|
||||
assert.NoError(t, err)
|
||||
if assert.NotNil(t, listCacheResponse) {
|
||||
assert.Equal(t, 1, listCacheResponse.TotalCount)
|
||||
assert.Equal(t, 1, len(listCacheResponse.ActionsCaches))
|
||||
assert.Equal(t, 29, listCacheResponse.ActionsCaches[0].Id)
|
||||
}
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -116,22 +119,22 @@ func TestListCaches_Failure(t *testing.T) {
|
||||
}`)
|
||||
|
||||
repo, err := internal.GetRepo("testOrg/testRepo")
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
f := types.ListOptions{BaseOptions: types.BaseOptions{Repo: "testOrg/testRepo"}, Limit: 30}
|
||||
queryParams := url.Values{}
|
||||
f.GenerateQueryParams(queryParams)
|
||||
|
||||
artifactCache, err := NewArtifactCache(repo, "list", VERSION)
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, artifactCache)
|
||||
listCacheResponse, err := artifactCache.ListCaches(queryParams)
|
||||
var httpError api.HTTPError
|
||||
errors.As(err, &httpError)
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, httpError.StatusCode, 404)
|
||||
assert.Equal(t, httpError.Message, "Not Found")
|
||||
assert.Equal(t, listCacheResponse, types.ListApiResponse{})
|
||||
if assert.ErrorAs(t, err, &httpError) {
|
||||
assert.Equal(t, 404, httpError.StatusCode)
|
||||
assert.Equal(t, "Not Found", httpError.Message)
|
||||
}
|
||||
assert.Equal(t, types.ListApiResponse{}, listCacheResponse)
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -156,18 +159,19 @@ func TestDeleteCaches_Success(t *testing.T) {
|
||||
}`)
|
||||
|
||||
repo, err := internal.GetRepo("testOrg/testRepo")
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
f := types.DeleteOptions{BaseOptions: types.BaseOptions{Repo: "testOrg/testRepo"}}
|
||||
queryParams := url.Values{}
|
||||
f.GenerateBaseQueryParams(queryParams)
|
||||
|
||||
artifactCache, err := NewArtifactCache(repo, "delete", VERSION)
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, artifactCache)
|
||||
deletedCache, err := artifactCache.DeleteCaches(queryParams)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, deletedCache, 1)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 1, deletedCache)
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
@@ -183,17 +187,18 @@ func TestDeleteCaches_Failure(t *testing.T) {
|
||||
}`)
|
||||
|
||||
repo, err := internal.GetRepo("testOrg/testRepo")
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
f := types.DeleteOptions{BaseOptions: types.BaseOptions{Repo: "testOrg/testRepo"}}
|
||||
queryParams := url.Values{}
|
||||
f.GenerateBaseQueryParams(queryParams)
|
||||
|
||||
artifactCache, err := NewArtifactCache(repo, "delete", VERSION)
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, artifactCache)
|
||||
deletedCache, err := artifactCache.DeleteCaches(queryParams)
|
||||
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, deletedCache, 0)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, 0, deletedCache)
|
||||
assert.True(t, gock.IsDone(), internal.PrintPendingMocks(gock.Pending()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user