mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-23 07:06:07 +00:00
Provide an input for github tokens (#172)
* Provide an input for github tokens - By providing an input for github tokens with a default users no longer have to pass the github token via their environment across workflows. - Remove GITHUB_TOKEN from our environment in all workflows * Don't run workflows on main on pull requests Co-authored-by: Paulo F. Oliveira <paulo.ferraz.oliveira@gmail.com>
This commit is contained in:
@@ -6,11 +6,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
types: [opened, synchronize]
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_integrity:
|
check_integrity:
|
||||||
|
|||||||
@@ -6,11 +6,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
types: [opened, synchronize]
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
integration_test:
|
integration_test:
|
||||||
|
|||||||
@@ -17,5 +17,3 @@ jobs:
|
|||||||
node-version: '14'
|
node-version: '14'
|
||||||
- run:
|
- run:
|
||||||
./.github/workflows/update_3rd_party_licenses.sh
|
./.github/workflows/update_3rd_party_licenses.sh
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
|
|||||||
@@ -6,11 +6,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
types: [opened, synchronize]
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
integration_test:
|
integration_test:
|
||||||
|
|||||||
@@ -8,6 +8,15 @@ branding:
|
|||||||
color: blue
|
color: blue
|
||||||
icon: code
|
icon: code
|
||||||
inputs:
|
inputs:
|
||||||
|
github-token:
|
||||||
|
description: >
|
||||||
|
A GitHub token used to access the GitHub REST API for retrieving release and version information.
|
||||||
|
While this action will never perform anything more than read operations against the GitHub REST API,
|
||||||
|
we do not recommend providing a self-generated personal access token which may provide more access than is
|
||||||
|
required of this action. This input instead is merely a convenience so that users of this action do not
|
||||||
|
have to manually pass an automatically generated token via their environment settings within a workflow.
|
||||||
|
[Learn more about automatically generated tokens](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)
|
||||||
|
default: ${{ github.token }}
|
||||||
otp-version:
|
otp-version:
|
||||||
description: Version range or exact version of Erlang/OTP to use,
|
description: Version range or exact version of Erlang/OTP to use,
|
||||||
or false when installing only Gleam without OTP
|
or false when installing only Gleam without OTP
|
||||||
|
|||||||
Vendored
+5
-2
@@ -7612,9 +7612,12 @@ async function get(url0, pageIdxs) {
|
|||||||
const headers = {
|
const headers = {
|
||||||
'user-agent': 'setup-beam',
|
'user-agent': 'setup-beam',
|
||||||
}
|
}
|
||||||
if (process.env.GITHUB_TOKEN) {
|
const GithubToken = getInput('github-token', false)
|
||||||
headers.authorization = `Bearer ${process.env.GITHUB_TOKEN}`
|
|
||||||
|
if (GithubToken) {
|
||||||
|
headers.authorization = `Bearer ${GithubToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pageIdx !== null) {
|
if (pageIdx !== null) {
|
||||||
url.searchParams.append('page', pageIdx)
|
url.searchParams.append('page', pageIdx)
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -419,9 +419,12 @@ async function get(url0, pageIdxs) {
|
|||||||
const headers = {
|
const headers = {
|
||||||
'user-agent': 'setup-beam',
|
'user-agent': 'setup-beam',
|
||||||
}
|
}
|
||||||
if (process.env.GITHUB_TOKEN) {
|
const GithubToken = getInput('github-token', false)
|
||||||
headers.authorization = `Bearer ${process.env.GITHUB_TOKEN}`
|
|
||||||
|
if (GithubToken) {
|
||||||
|
headers.authorization = `Bearer ${GithubToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pageIdx !== null) {
|
if (pageIdx !== null) {
|
||||||
url.searchParams.append('page', pageIdx)
|
url.searchParams.append('page', pageIdx)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user