Skip to content

Commit 1a641d3

Browse files
authored
Merge pull request #212 from arnested/avoid-need-for-github-token
Avoid the need for GITHUB_TOKEN
2 parents f2d49ca + 828c065 commit 1a641d3

File tree

11 files changed

+30679
-3529
lines changed

11 files changed

+30679
-3529
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ jobs:
3232
id: go-version
3333
with:
3434
working-directory: ./__tests__/testdata
35-
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3735
- run: |
3836
test '${{ steps.go-version.outputs.module }}' == 'example.com/go/testmodule'
3937
- run: |

README.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ The action reads the minimal supported Go version from your `go.mod`
2424
file and exposes it as a variable to you workflow.
2525

2626
It also pulls the list of release tags from
27-
[github.com/golang/go](https://github.com/golang/go) and exposes the
28-
latest released Go version as a variable as well.
27+
[https://go.dev/dl/](https://go.dev/dl/) and exposes the latest
28+
released Go version as a variable as well.
2929

3030
From the list of released go versions and the minimal version your
3131
module supports we also build a "matrix" variable to be used as a
@@ -46,14 +46,6 @@ working-directory:
4646
default: .
4747
```
4848
49-
To avoid API rate limits when fetching go releases from GitHub it is
50-
recommended to set a token:
51-
52-
```yaml
53-
env:
54-
GITHUB_TOKEN: ${{ github.token }}
55-
```
56-
5749
## Outputs
5850
5951
```yaml
@@ -84,8 +76,6 @@ jobs:
8476
- uses: actions/checkout@v2
8577
- uses: arnested/go-version-action@v1
8678
id: go-version
87-
env:
88-
GITHUB_TOKEN: ${{ github.token }}
8979
- name: Install Go ${{ steps.go-version.outputs.minimal }}
9080
uses: actions/setup-go@v2
9181
with:
@@ -115,8 +105,6 @@ jobs:
115105
- uses: actions/checkout@v2
116106
- uses: arnested/go-version-action@v1
117107
id: versions
118-
env:
119-
GITHUB_TOKEN: ${{ github.token }}
120108
test:
121109
name: Test
122110
runs-on: ubuntu-latest

__tests__/main.test.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
import {
2-
gomod,
3-
latest,
4-
minimal,
5-
matrix,
6-
modulename,
7-
getTags
8-
} from '../src/go-versions'
91
import fs from 'fs'
2+
import {gomod, latest, matrix, minimal, modulename} from '../src/go-versions'
103

114
test('test module name', () => {
125
const content = gomod('__tests__/testdata/go.mod')
@@ -19,13 +12,13 @@ test('test minimal version', () => {
1912
})
2013

2114
test('test latest version', () => {
22-
expect(latest(['1.16', '1.15', '1.14', '1.13'])).toEqual('1.16')
15+
expect(latest(['1.18', '1.17', '1.16', '1.15', '1.14', '1.13'])).toEqual(
16+
'1.18'
17+
)
2318
})
2419

2520
test('test version matrix', () => {
26-
const t = JSON.parse(
27-
fs.readFileSync('__tests__/testdata/listTags.json', 'utf8')
28-
)
21+
const t = JSON.parse(fs.readFileSync('__tests__/testdata/dl.json', 'utf8'))
2922
const m = matrix('1.13', t)
30-
expect(m).toEqual(['1.16', '1.15', '1.14', '1.13'])
23+
expect(m).toEqual(['1.18', '1.17', '1.16', '1.15', '1.14', '1.13'])
3124
})

0 commit comments

Comments
 (0)