Provide an input for github tokens (#172)

e3f6ffe · Bryan Paxton · 2023-01-06 16:14

7 files +22 -21
Message
{commit_body(@commit)}

Files changed

modified .github/workflows/action.yml
+1 −5
@@ -6,11 +6,7 @@ on:
6 6 branches:
7 7 - main
8 8 pull_request:
9 branches:
10 - main
11
12 env:
13 GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
9 + types: [opened, synchronize]
14 10
15 11 jobs:
16 12 check_integrity:
modified .github/workflows/ubuntu.yml
+1 −5
@@ -6,11 +6,7 @@ on:
6 6 branches:
7 7 - main
8 8 pull_request:
9 branches:
10 - main
11
12 env:
13 GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
9 + types: [opened, synchronize]
14 10
15 11 jobs:
16 12 integration_test:
modified .github/workflows/update_3rd_party_licenses.yml
+0 −2
@@ -17,5 +17,3 @@ jobs:
17 17 node-version: '14'
18 18 - run:
19 19 ./.github/workflows/update_3rd_party_licenses.sh
20 env:
21 GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
modified .github/workflows/windows.yml
+1 −5
@@ -6,11 +6,7 @@ on:
6 6 branches:
7 7 - main
8 8 pull_request:
9 branches:
10 - main
11
12 env:
13 GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
9 + types: [opened, synchronize]
14 10
15 11 jobs:
16 12 integration_test:
modified action.yml
+9 −0
@@ -8,6 +8,15 @@ branding:
8 8 color: blue
9 9 icon: code
10 10 inputs:
11 + github-token:
12 + description: >
13 + A GitHub token used to access the GitHub REST API for retrieving release and version information.
14 + While this action will never perform anything more than read operations against the GitHub REST API,
15 + we do not recommend providing a self-generated personal access token which may provide more access than is
16 + required of this action. This input instead is merely a convenience so that users of this action do not
17 + have to manually pass an automatically generated token via their environment settings within a workflow.
18 + [Learn more about automatically generated tokens](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)
19 + default: ${{ github.token }}
11 20 otp-version:
12 21 description: Version range or exact version of Erlang/OTP to use,
13 22 or false when installing only Gleam without OTP
modified dist/index.js
+5 −2
@@ -7612,9 +7612,12 @@ async function get(url0, pageIdxs) {
7612 7612 const headers = {
7613 7613 'user-agent': 'setup-beam',
7614 7614 }
7615 if (process.env.GITHUB_TOKEN) {
7616 headers.authorization = `Bearer ${process.env.GITHUB_TOKEN}`
7615 + const GithubToken = getInput('github-token', false)
7616 +
7617 + if (GithubToken) {
7618 + headers.authorization = `Bearer ${GithubToken}`
7617 7619 }
7620 +
7618 7621 if (pageIdx !== null) {
7619 7622 url.searchParams.append('page', pageIdx)
7620 7623 }
modified src/setup-beam.js
+5 −2
@@ -419,9 +419,12 @@ async function get(url0, pageIdxs) {
419 419 const headers = {
420 420 'user-agent': 'setup-beam',
421 421 }
422 if (process.env.GITHUB_TOKEN) {
423 headers.authorization = `Bearer ${process.env.GITHUB_TOKEN}`
422 + const GithubToken = getInput('github-token', false)
423 +
424 + if (GithubToken) {
425 + headers.authorization = `Bearer ${GithubToken}`
424 426 }
427 +
425 428 if (pageIdx !== null) {
426 429 url.searchParams.append('page', pageIdx)
427 430 }

Parents: 81d8403