mirror of
https://github.com/DeLaGuardo/setup-clojure.git
synced 2024-12-25 23:40:49 +08:00
Use 'Bearer gh-token' instead of 'token gh-token'
to authenticate GH API calls * Upgrade node-version to 20.10.0 * Upgrade dependencies * Upgrade base node version to run action on * Correct authentication token format
This commit is contained in:
parent
0fc99a3bcd
commit
d2ddd6fe91
4
.github/workflows/workflow.yml
vendored
4
.github/workflows/workflow.yml
vendored
@ -11,10 +11,10 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@main
|
||||
|
||||
- name: Set Node.js 16.x
|
||||
- name: Set Node.js 20.x
|
||||
uses: actions/setup-node@master
|
||||
with:
|
||||
version: 16.x
|
||||
version: 20.x
|
||||
|
||||
- name: Setup java
|
||||
uses: actions/setup-java@v3
|
||||
|
@ -1 +1 @@
|
||||
18.4.0
|
||||
20.10.0
|
||||
|
@ -46,7 +46,7 @@ jobs:
|
||||
java-version: '8'
|
||||
|
||||
- name: Install clojure tools
|
||||
uses: DeLaGuardo/setup-clojure@12.1
|
||||
uses: DeLaGuardo/setup-clojure@12.2
|
||||
with:
|
||||
# Install just one or all simultaneously
|
||||
# The value must indicate a particular version of the tool, or use 'latest'
|
||||
|
@ -56,7 +56,7 @@ describe('setup-clojure', () => {
|
||||
|
||||
await main()
|
||||
|
||||
expect(lein.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
|
||||
expect(lein.setup).toHaveBeenCalledWith('1.2.3', 'Bearer abc')
|
||||
})
|
||||
|
||||
it('sets up Boot', async () => {
|
||||
@ -65,7 +65,7 @@ describe('setup-clojure', () => {
|
||||
|
||||
await main()
|
||||
|
||||
expect(boot.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
|
||||
expect(boot.setup).toHaveBeenCalledWith('1.2.3', 'Bearer abc')
|
||||
})
|
||||
|
||||
it('sets up Clojure CLI tools from deprecated `tools-deps` option', async () => {
|
||||
@ -90,7 +90,7 @@ describe('setup-clojure', () => {
|
||||
|
||||
await main()
|
||||
|
||||
expect(bb.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
|
||||
expect(bb.setup).toHaveBeenCalledWith('1.2.3', 'Bearer abc')
|
||||
})
|
||||
|
||||
it('sets up clj-kondo', async () => {
|
||||
@ -99,7 +99,7 @@ describe('setup-clojure', () => {
|
||||
|
||||
await main()
|
||||
|
||||
expect(cljKondo.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
|
||||
expect(cljKondo.setup).toHaveBeenCalledWith('1.2.3', 'Bearer abc')
|
||||
})
|
||||
|
||||
it('sets up cljfmt', async () => {
|
||||
@ -108,7 +108,7 @@ describe('setup-clojure', () => {
|
||||
|
||||
await main()
|
||||
|
||||
expect(cljfmt.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
|
||||
expect(cljfmt.setup).toHaveBeenCalledWith('1.2.3', 'Bearer abc')
|
||||
})
|
||||
|
||||
it('sets up cljstyle', async () => {
|
||||
@ -117,7 +117,7 @@ describe('setup-clojure', () => {
|
||||
|
||||
await main()
|
||||
|
||||
expect(cljstyle.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
|
||||
expect(cljstyle.setup).toHaveBeenCalledWith('1.2.3', 'Bearer abc')
|
||||
})
|
||||
|
||||
it('throws on cljstyle setup in Windows', async () => {
|
||||
@ -153,6 +153,6 @@ describe('setup-clojure', () => {
|
||||
|
||||
await main()
|
||||
|
||||
expect(zprint.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
|
||||
expect(zprint.setup).toHaveBeenCalledWith('1.2.3', 'Bearer abc')
|
||||
})
|
||||
})
|
||||
|
@ -41,8 +41,8 @@ inputs:
|
||||
invalidate-cache:
|
||||
description: >+
|
||||
Set to `true` to fix problems related to wrongly populated tool cache
|
||||
default: false
|
||||
default: 'false'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node16'
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
|
23725
dist/index.js
vendored
23725
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
7438
package-lock.json
generated
7438
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-clojure",
|
||||
"version": "12.1",
|
||||
"version": "12.2",
|
||||
"private": true,
|
||||
"description": "setup clojure action",
|
||||
"main": "lib/setup-clojure.js",
|
||||
@ -28,27 +28,26 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^3.2.2",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/http-client": "^2.1.1",
|
||||
"@actions/http-client": "^2.2.0",
|
||||
"@actions/io": "^1.1.3",
|
||||
"@actions/tool-cache": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.4",
|
||||
"@types/node": "^20.5.9",
|
||||
"@types/semver": "^7.5.1",
|
||||
"@typescript-eslint/parser": "^6.6.0",
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-plugin-github": "^4.10.0",
|
||||
"eslint-plugin-jest": "^27.2.3",
|
||||
"jest": "^29.6.4",
|
||||
"jest-circus": "^29.6.4",
|
||||
"@types/jest": "^29.5.11",
|
||||
"@types/node": "^20.10.6",
|
||||
"@types/semver": "^7.5.6",
|
||||
"@typescript-eslint/parser": "^6.17.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
"eslint-plugin-jest": "^27.6.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"npm-check-updates": "^16.13.2",
|
||||
"prettier": "3.0.3",
|
||||
"prettier": "3.1.1",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.2.2"
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ async function toolVersion(
|
||||
version: string,
|
||||
githubAuth?: string
|
||||
): Promise<string> {
|
||||
core.debug('=== Check tool version')
|
||||
if (version === 'latest') {
|
||||
const res = await client.getJson<{tag_name: string}>(
|
||||
'https://api.github.com/repos/clojure/brew-install/releases/latest',
|
||||
@ -51,6 +52,7 @@ async function getUrls(
|
||||
tag: string,
|
||||
githubAuth?: string
|
||||
): Promise<{posix?: string; linux: string; windows: string}> {
|
||||
core.debug('=== Get download URLs')
|
||||
const res = await client.getJson<{
|
||||
assets: {browser_download_url: string}[]
|
||||
}>(
|
||||
@ -78,6 +80,7 @@ export async function setup(
|
||||
requestedVersion: string,
|
||||
githubToken?: string
|
||||
): Promise<void> {
|
||||
core.debug('=== Run setup')
|
||||
const version = await toolVersion(requestedVersion, githubToken)
|
||||
const installDir = utils.isWindows()
|
||||
? 'C:\\Program Files\\WindowsPowerShell\\Modules'
|
||||
@ -167,6 +170,7 @@ async function runLinuxInstall(
|
||||
installScript: string,
|
||||
destinationFolder: string
|
||||
): Promise<string> {
|
||||
core.debug('=== Install on Linux')
|
||||
await io.mkdirP(destinationFolder)
|
||||
|
||||
const file = path.normalize(installScript)
|
||||
@ -176,6 +180,7 @@ async function runLinuxInstall(
|
||||
}
|
||||
|
||||
async function MacOSDeps(file: string, githubToken?: string): Promise<void> {
|
||||
core.debug('=== Install extra deps for MacOS')
|
||||
const data = await fs.readFile(file, 'utf-8')
|
||||
const newValue = data.replace(
|
||||
/install -D/gim,
|
||||
@ -183,12 +188,13 @@ async function MacOSDeps(file: string, githubToken?: string): Promise<void> {
|
||||
)
|
||||
await fs.writeFile(file, newValue, 'utf-8')
|
||||
const env = githubToken
|
||||
? {env: {HOMEBREW_GITHUB_API_TOKEN: githubToken}}
|
||||
? {env: {HOMEBREW_GITHUB_API_TOKEN: githubToken.substring(7)}}
|
||||
: undefined
|
||||
await exec.exec('brew', ['install', 'coreutils'], env)
|
||||
}
|
||||
|
||||
export async function getLatestDepsClj(githubAuth?: string): Promise<string> {
|
||||
core.debug('=== Fetch latest version of deps clj')
|
||||
const res = await client.getJson<{tag_name: string}>(
|
||||
`https://api.github.com/repos/borkdude/deps.clj/releases/latest`,
|
||||
githubAuth ? {Authorization: githubAuth} : undefined
|
||||
|
@ -27,7 +27,7 @@ export async function main(): Promise<void> {
|
||||
const tools = []
|
||||
|
||||
const githubToken = core.getInput('github-token')
|
||||
const githubAuth = githubToken ? `token ${githubToken}` : undefined
|
||||
const githubAuth = githubToken ? `Bearer ${githubToken}` : undefined
|
||||
const IS_WINDOWS = utils.isWindows()
|
||||
|
||||
if (LEIN_VERSION) {
|
||||
|
@ -1 +1 @@
|
||||
export const VERSION = '12-1'
|
||||
export const VERSION = '12-2'
|
||||
|
Loading…
x
Reference in New Issue
Block a user