Skip to content

Commit 4ade84e

Browse files
authored
Add golangci-lint and stale workflows (#27)
1 parent a1341df commit 4ade84e

9 files changed

+84
-17
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- main
8+
pull_request:
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
- uses: actions/setup-go@v3
17+
with:
18+
go-version: '1.18.*'
19+
- name: golangci-lint
20+
uses: golangci/golangci-lint-action@v3
21+
with:
22+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
23+
version: latest
24+
args: --timeout=10m

.github/workflows/stale.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Stale Issues and PRs"
2+
on:
3+
schedule:
4+
- cron: "30 23 * * *"
5+
workflow_dispatch:
6+
inputs:
7+
debugOnly:
8+
description: "Set to true for a dry run"
9+
required: false
10+
default: "false"
11+
12+
jobs:
13+
stale:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Set environment variables
17+
id: set-stale-action-env
18+
run: |
19+
echo "STALE_ISSUE_MESSAGE=This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days." >> $GITHUB_ENV
20+
echo "STALE_PR_MESSAGE=This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days." >> $GITHUB_ENV
21+
echo "CLOSE_ISSUE_MESSAGE=This issue was closed because it has been stalled for 90 days with no activity." >> $GITHUB_ENV
22+
echo "CLOSE_PR_MESSAGE=This PR was closed because it has been stalled for 90 days with no activity." >> $GITHUB_ENV
23+
echo "DAYS_BEFORE_STALE=60" >> $GITHUB_ENV
24+
# DAYS_BEFORE_CLOSE is set to 30 because the we want to close the issue/PR after 90 days total (DAYS_BEFORE_STALE value is 60)
25+
echo "DAYS_BEFORE_CLOSE=30" >> $GITHUB_ENV
26+
echo "STALE_ISSUE_LABEL=stale" >> $GITHUB_ENV
27+
echo "STALE_PR_LABEL=stale" >> $GITHUB_ENV
28+
29+
- name: Stale issues and PRs
30+
id: stale-issues-or-prs
31+
uses: actions/stale@v3
32+
with:
33+
repo-token: ${{ secrets.GITHUB_TOKEN }}
34+
debug-only: ${{ github.event.inputs.debugOnly }}
35+
stale-issue-message: ${{ env.STALE_ISSUE_MESSAGE }}
36+
stale-pr-message: ${{ env.STALE_PR_MESSAGE }}
37+
close-issue-message: ${{ env.CLOSE_ISSUE_MESSAGE }}
38+
close-pr-message: ${{ env.CLOSE_PR_MESSAGE }}
39+
days-before-stale: ${{ env.DAYS_BEFORE_STALE }}
40+
days-before-close: ${{ env.DAYS_BEFORE_CLOSE }}
41+
stale-issue-label: ${{ env.STALE_ISSUE_LABEL }}
42+
stale-pr-label: ${{ env.STALE_PR_LABEL }}

zendesk/table_zendesk_organization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func listOrganization(ctx context.Context, d *plugin.QueryData, _ *plugin.Hydrat
5050
PerPage: 100,
5151
},
5252
}
53-
for true {
53+
for {
5454
organizations, page, err := conn.GetOrganizations(ctx, opts)
5555
if err != nil {
5656
return nil, err

zendesk/table_zendesk_search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func listSearch(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData)
4848
Query: q,
4949
}
5050
n := 0
51-
for true {
51+
for {
5252
results, page, err := conn.Search(ctx, opts)
5353
if err != nil {
5454
return nil, err

zendesk/table_zendesk_ticket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func listTicket(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData)
8181
PerPage: 100,
8282
},
8383
}
84-
for true {
84+
for {
8585
tickets, page, err := conn.GetTickets(ctx, opts)
8686
if err != nil {
8787
return nil, err

zendesk/table_zendesk_ticket_audit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func listTicketAudit(ctx context.Context, d *plugin.QueryData, _ *plugin.Hydrate
4545
return nil, err
4646
}
4747
opts := zendesk.CursorOption{}
48-
for true {
48+
for {
4949
ticketAudits, cursor, err := conn.GetAllTicketAudits(ctx, opts)
5050
if err != nil {
5151
return nil, err

zendesk/table_zendesk_trigger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func listTrigger(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData
5555
PerPage: 100,
5656
},
5757
}
58-
for true {
58+
for {
5959
triggers, page, err := conn.GetTriggers(ctx, opts)
6060
if err != nil {
6161
return nil, err

zendesk/table_zendesk_user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func listUser(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (
8080
PerPage: 100,
8181
},
8282
}
83-
for true {
83+
for {
8484
users, page, err := conn.GetUsers(ctx, opts)
8585
if err != nil {
8686
return nil, err

zendesk/utils.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@ func connect(ctx context.Context, d *plugin.QueryData) (*zendesk.Client, error)
2121
token := os.Getenv("ZENDESK_TOKEN")
2222

2323
zendeskConfig := GetConfig(d.Connection)
24-
if &zendeskConfig != nil {
25-
if zendeskConfig.SubDomain != nil {
26-
subdomain = *zendeskConfig.SubDomain
27-
}
28-
if zendeskConfig.Email != nil {
29-
user = *zendeskConfig.Email
30-
}
31-
if zendeskConfig.Token != nil {
32-
token = *zendeskConfig.Token
33-
}
24+
if zendeskConfig.SubDomain != nil {
25+
subdomain = *zendeskConfig.SubDomain
26+
}
27+
if zendeskConfig.Email != nil {
28+
user = *zendeskConfig.Email
29+
}
30+
if zendeskConfig.Token != nil {
31+
token = *zendeskConfig.Token
3432
}
3533

3634
if subdomain == "" {
@@ -46,7 +44,10 @@ func connect(ctx context.Context, d *plugin.QueryData) (*zendesk.Client, error)
4644
}
4745

4846
// example.zendesk.com
49-
client.SetSubdomain(subdomain)
47+
err = client.SetSubdomain(subdomain)
48+
if err != nil {
49+
return nil, err
50+
}
5051

5152
// Authenticate with API token
5253
client.SetCredential(zendesk.NewAPITokenCredential(user, token))

0 commit comments

Comments
 (0)