Skip to content

Commit aaf3e91

Browse files
committed
feat: ci and badges
1 parent 595ff52 commit aaf3e91

File tree

9 files changed

+164
-4
lines changed

9 files changed

+164
-4
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [pd93]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Issue awaiting response
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
issue-awaiting-response:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/github-script@v7
12+
with:
13+
script: |
14+
const issue = await github.rest.issues.get({
15+
owner: context.repo.owner,
16+
repo: context.repo.repo,
17+
issue_number: context.issue.number,
18+
})
19+
const comments = await github.paginate(
20+
github.rest.issues.listComments, {
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
issue_number: context.issue.number,
24+
}
25+
)
26+
const labels = await github.paginate(
27+
github.rest.issues.listLabelsOnIssue, {
28+
issue_number: context.issue.number,
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
}
32+
)
33+
if (labels.find(label => label.name === 'state: awaiting response')) {
34+
if (comments[comments.length-1].user?.login === issue.data.user?.login) {
35+
github.rest.issues.removeLabel({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
issue_number: context.issue.number,
39+
name: 'state: awaiting response'
40+
})
41+
}
42+
}

.github/workflows/issue-closed.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Issue closed
2+
3+
on:
4+
issues:
5+
types: [closed]
6+
7+
jobs:
8+
issue-closed:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/github-script@v7
12+
with:
13+
script: |
14+
const labels = await github.paginate(
15+
github.rest.issues.listLabelsOnIssue, {
16+
issue_number: context.issue.number,
17+
owner: context.repo.owner,
18+
repo: context.repo.repo,
19+
}
20+
)
21+
if (labels.find(label => label.name === 'state: needs triage')) {
22+
github.rest.issues.removeLabel({
23+
owner: context.repo.owner,
24+
repo: context.repo.repo,
25+
issue_number: context.issue.number,
26+
name: 'state: needs triage'
27+
})
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Issue needs triage
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
issue-needs-triage:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/github-script@v7
12+
with:
13+
script: |
14+
const labels = await github.paginate(
15+
github.rest.issues.listLabelsOnIssue, {
16+
issue_number: context.issue.number,
17+
owner: context.repo.owner,
18+
repo: context.repo.repo,
19+
}
20+
)
21+
if (labels.length === 0) {
22+
github.rest.issues.addLabels({
23+
issue_number: context.issue.number,
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
labels: ['state: needs triage']
27+
})
28+
}

.github/workflows/lint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
push:
6+
tags:
7+
- v*
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
name: Lint Go code
14+
strategy:
15+
matrix:
16+
go-version:
17+
- 1.20.x
18+
- 1.21.x
19+
- 1.22.x
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Set up Go ${{matrix.go-version}}
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: ${{matrix.go-version}}
26+
- name: Check out code
27+
uses: actions/checkout@v4
28+
- name: Lint
29+
uses: golangci/golangci-lint-action@v6
30+
with:
31+
version: v1.59.1

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
test:
13-
name: Test
13+
name: Test Go code
1414
strategy:
1515
matrix:
1616
go-version:

.golangci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
linters:
2+
enable:
3+
- goimports
4+
- gofmt
5+
- gofumpt
6+
7+
linters-settings:
8+
goimports:
9+
local-prefixes: github.com/pd93
10+
gofmt:
11+
rewrite-rules:
12+
- pattern: 'interface{}'
13+
replacement: 'any'

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@
22
<img src="res/title.svg">
33
</div>
44

5-
<p align="center">
6-
<i>A simple, lightweight Golang package for working with ANSI escape codes.</i>
7-
</p>
5+
<div align="center">
6+
<i>A simple, lightweight Golang package for working with ANSI escape codes.</i><br>
7+
<br>
8+
</div>
9+
10+
<div align="center">
11+
12+
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/pd93/ansi?style=flat-square)
13+
[![Go Doc](http://img.shields.io/badge/pkg.go.dev-ansi-3a7a9a?style=flat-square)](https://pkg.go.dev/github.com/pd93/ansi)
14+
[![GitHub Release](https://img.shields.io/github/v/release/pd93/ansi?style=flat-square)](https://github.com/pd93/ansi/releases)
15+
[![GitHub License](https://img.shields.io/github/license/pd93/ansi?style=flat-square)](https://github.com/pd93/ansi/blob/main/LICENSE)
16+
![GitHub Repo stars](https://img.shields.io/github/stars/pd93/ansi?style=flat-square)
17+
[![GitHub Sponsors](https://img.shields.io/github/sponsors/pd93?style=flat-square)](https://github.com/sponsors/pd93)
18+
19+
</div>
820
<br>
921

1022
If you've ever worked on a CLI application before, you probably know the

taskfile.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ tasks:
66
cmds:
77
- go run ./examples/...
88

9+
lint:
10+
description: "Run linter"
11+
cmds:
12+
- golangci-lint run
13+
914
test:
1015
description: "Run all tests"
1116
cmds:

0 commit comments

Comments
 (0)