Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is a fake PR to demonstrate Listen.Dev #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,27 +223,21 @@ jobs:
ping -c 5 -w 5 www.uol.com.br > /dev/null 2>&1 || true
#
- name: Network 02
uses: ./.github/actions/test
#
- name: Network 03
run: |
curl -s --connect-timeout 5 -m 5 -o /dev/null https://www.pinterest.com || true
curl -s --connect-timeout 5 -m 5 -o /dev/null https://www.etsy.com || true
curl -s --connect-timeout 5 -m 5 -o /dev/null https://www.skype.com || true
curl -s --connect-timeout 5 -m 5 -o /dev/null https://www.snapchat.com || true
curl -s --connect-timeout 5 -m 5 -o /dev/null https://www.whatsapp.com || true
#
- name: Network 04
uses: rafaeldtinoco/list-github-env@v0.4
#
- name: Network 05
- name: Network 03
run: |
ping -c 5 -w 5 www.google.com > /dev/null 2>&1 || true
ping -c 5 -w 5 www.google.com > /dev/null 2>&1 || true
ping -c 5 -w 5 8.8.4.4 > /dev/null 2>&1 || true
ping -c 5 -w 5 8.8.8.8 > /dev/null 2>&1 || true
#
- name: Network 06
- name: Network 04
run: |
ping -c 5 -w 5 1.1.1.1 > /dev/null 2>&1 || true
curl -s --connect-timeout 5 -m 5 -o /dev/null https://www.etsy.com || true
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/linter.yml

This file was deleted.

76 changes: 0 additions & 76 deletions .github/workflows/tests.yml

This file was deleted.

17 changes: 17 additions & 0 deletions github/activity_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,23 @@ func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Respo
return s.client.Do(ctx, req, nil)
}

// MarkThreadDone marks the specified thread as done.
// Marking a thread as "done" is equivalent to marking a notification in your notification inbox on GitHub as done.
//
// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-done
//
//meta:operation DELETE /notifications/threads/{thread_id}
func (s *ActivityService) MarkThreadDone(ctx context.Context, id int64) (*Response, error) {
u := fmt.Sprintf("notifications/threads/%v", id)

req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
return nil, err
}

return s.client.Do(ctx, req, nil)
}

// GetThreadSubscription checks to see if the authenticated user is subscribed
// to a thread.
//
Expand Down
26 changes: 26 additions & 0 deletions github/activity_notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,32 @@ func TestActivityService_MarkThreadRead(t *testing.T) {
})
}

func TestActivityService_MarkThreadDone(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

mux.HandleFunc("/notifications/threads/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
w.WriteHeader(http.StatusResetContent)
})

ctx := context.Background()
_, err := client.Activity.MarkThreadDone(ctx, 1)
if err != nil {
t.Errorf("Activity.MarkThreadDone returned error: %v", err)
}

const methodName = "MarkThreadDone"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Activity.MarkThreadDone(ctx, 0)
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Activity.MarkThreadDone(ctx, 1)
})
}

func TestActivityService_GetThreadSubscription(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
Expand Down
12 changes: 11 additions & 1 deletion github/orgs_credential_authorizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,23 @@ type CredentialAuthorization struct {
AuthorizedCredentialExpiresAt *Timestamp `json:"authorized_credential_expires_at,omitempty"`
}

// CredentialAuthorizationsListOptions adds the Login option as supported by the
// list SAML SSO authorizations for organizations endpoint alongside paging options
// such as Page and PerPage.
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization
type CredentialAuthorizationsListOptions struct {
ListOptions
// For credentials authorizations for an organization, limit the list of authorizations to a specific login (aka github username)
Login string `url:"login,omitempty"`
}

// ListCredentialAuthorizations lists credentials authorized through SAML SSO
// for a given organization. Only available with GitHub Enterprise Cloud.
//
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization
//
//meta:operation GET /orgs/{org}/credential-authorizations
func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, org string, opts *ListOptions) ([]*CredentialAuthorization, *Response, error) {
func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, org string, opts *CredentialAuthorizationsListOptions) ([]*CredentialAuthorization, *Response, error) {
u := fmt.Sprintf("orgs/%v/credential-authorizations", org)
u, err := addOptions(u, opts)
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions github/orgs_credential_authorizations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestOrganizationsService_ListCredentialAuthorizations(t *testing.T) {

mux.HandleFunc("/orgs/o/credential-authorizations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
testFormValues(t, r, values{"per_page": "2", "page": "2"})
testFormValues(t, r, values{"per_page": "2", "page": "2", "login": "l"})
fmt.Fprint(w, `[
{
"login": "l",
Expand All @@ -34,7 +34,11 @@ func TestOrganizationsService_ListCredentialAuthorizations(t *testing.T) {
]`)
})

opts := &ListOptions{Page: 2, PerPage: 2}
opts := &CredentialAuthorizationsListOptions{
ListOptions: ListOptions{Page: 2, PerPage: 2},
Login: "l",
}

ctx := context.Background()
creds, _, err := client.Organizations.ListCredentialAuthorizations(ctx, "o", opts)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion github/repos_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ func NewFilePathRestrictionRule(params *RuleFileParameters) (rule *RepositoryRul
type Ruleset struct {
ID *int64 `json:"id,omitempty"`
Name string `json:"name"`
// Possible values for Target are branch, tag
// Possible values for Target are branch, tag, push
Target *string `json:"target,omitempty"`
// Possible values for SourceType are: Repository, Organization
SourceType *string `json:"source_type,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion scrape/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"strings"

"github.com/PuerkitoBio/goquery"
"github.com/google/go-github/v64/github"
"github.com/google/go-github/v65/github"
)

// AppRestrictionsEnabled returns whether the specified organization has
Expand Down
2 changes: 1 addition & 1 deletion scrape/apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-github/v64/github"
"github.com/google/go-github/v65/github"
)

func Test_AppRestrictionsEnabled(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion scrape/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.0
require (
github.com/PuerkitoBio/goquery v1.9.2
github.com/google/go-cmp v0.6.0
github.com/google/go-github/v64 v64.0.0
github.com/google/go-github/v65 v65.0.0
github.com/xlzd/gotp v0.1.0
golang.org/x/net v0.29.0
)
Expand Down
4 changes: 2 additions & 2 deletions scrape/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v64 v64.0.0 h1:4G61sozmY3eiPAjjoOHponXDBONm+utovTKbyUb2Qdg=
github.com/google/go-github/v64 v64.0.0/go.mod h1:xB3vqMQNdHzilXBiO2I+M7iEFtHf+DP/omBOv6tQzVo=
github.com/google/go-github/v65 v65.0.0 h1:pQ7BmO3DZivvFk92geC0jB0q2m3gyn8vnYPgV7GSLhQ=
github.com/google/go-github/v65 v65.0.0/go.mod h1:DvrqWo5hvsdhJvHd4WyVF9ttANN3BniqjP8uTFMNb60=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po=
Expand Down
2 changes: 1 addition & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
toolchain go1.22.0

require (
github.com/alecthomas/kong v0.9.0
github.com/alecthomas/kong v1.2.1
github.com/getkin/kin-openapi v0.127.0
github.com/google/go-cmp v0.6.0
github.com/google/go-github/v65 v65.0.0
Expand Down
8 changes: 4 additions & 4 deletions tools/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU=
github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/kong v0.9.0 h1:G5diXxc85KvoV2f0ZRVuMsi45IrBgx9zDNGNj165aPA=
github.com/alecthomas/kong v0.9.0/go.mod h1:Y47y5gKfHp1hDc7CH7OeXgLIpp+Q2m1Ni0L5s3bI8Os=
github.com/alecthomas/assert/v2 v2.10.0 h1:jjRCHsj6hBJhkmhznrCzoNpbA3zqy0fYiUcYZP/GkPY=
github.com/alecthomas/assert/v2 v2.10.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/kong v1.2.1 h1:E8jH4Tsgv6wCRX2nGrdPyHDUCSG83WH2qE4XLACD33Q=
github.com/alecthomas/kong v1.2.1/go.mod h1:rKTSFhbdp3Ryefn8x5MOEprnRFQ7nlmMC01GKhehhBM=
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
Loading