Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update action to use node 20 #552

Merged
merged 2 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: '16'
node-version: '20'

- name: Run `npm install`
run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: '16'
node-version: '20'

- name: Run `npm install`
run: npm install
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ inputs:
required: false

runs:
using: node16
using: node20
pre: dist/pre.js
main: dist/main.js
post: dist/post.js
21 changes: 12 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "scala-steward-action",
"description": "A GitHub Action to launch Scala Steward in your repository",
"scripts": {
"tsconfig": "echo '{ \"extends\": \"@tsconfig/recommended/tsconfig.json\" }' > tsconfig.json",
"tsconfig": "echo '{ \"extends\": \"@tsconfig/node20/tsconfig.json\" }' > tsconfig.json",
"build": "npm run tsconfig && npm run build-pre && npm run build-main && npm run build-post",
"build-pre": "ncc build --target es2019 src/action/pre.ts && mv dist/index.js dist/pre.js",
"build-main": "ncc build --target es2019 src/action/main.ts && mv dist/index.js dist/main.js",
"build-post": "ncc build --target es2019 src/action/post.ts && mv dist/index.js dist/post.js",
"build-pre": "ncc build --target es2022 src/action/pre.ts && mv dist/index.js dist/pre.js",
"build-main": "ncc build --target es2022 src/action/main.ts && mv dist/index.js dist/main.js",
"build-post": "ncc build --target es2022 src/action/post.ts && mv dist/index.js dist/post.js",
"docs": "ts-node src/utils/docs.ts && markdown-toc-gen update README.md",
"contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate",
Expand All @@ -15,6 +15,9 @@
"report": "c8 report",
"all": "npm run build && npm test && npm run report"
},
"engines": {
"node": ">=20"
},
"repository": {
"type": "git",
"url": "git+https://github.com/scala-steward-org/scala-steward-action.git"
Expand Down Expand Up @@ -43,7 +46,7 @@
},
"devDependencies": {
"@ava/typescript": "^4.1.0",
"@tsconfig/recommended": "^1.0.3",
"@tsconfig/node20": "^20.1.2",
"@types/js-yaml": "^4.0.5",
"@types/node": "^20.4.5",
"@vercel/ncc": "^0.36.1",
Expand Down
21 changes: 14 additions & 7 deletions src/modules/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,26 @@ export class Workspace {
return new Workspace(logger, files, os, cache)
}

readonly directory = path.join(this.os.homedir(), 'scala-steward')
readonly workspace = mandatory(path.join(this.directory, 'workspace'))
readonly repos_md = mandatory(path.join(this.directory, 'repos.md'))
readonly app_pem = mandatory(path.join(this.directory, 'app.pem'))
readonly askpass_sh = mandatory(path.join(this.directory, 'askpass.sh'))
readonly runSummary_md: string = path.join(this.workspace.value, 'run-summary.md')
readonly directory: string
readonly workspace: NonEmptyString
readonly repos_md: NonEmptyString
readonly app_pem: NonEmptyString
readonly askpass_sh: NonEmptyString
readonly runSummary_md: string

constructor(
private readonly logger: Logger,
private readonly files: Files,
private readonly os: OSInfo,
private readonly cache: ActionCache,
) {}
) {
this.directory = path.join(this.os.homedir(), 'scala-steward')
this.workspace = mandatory(path.join(this.directory, 'workspace'))
this.repos_md = mandatory(path.join(this.directory, 'repos.md'))
this.app_pem = mandatory(path.join(this.directory, 'app.pem'))
this.askpass_sh = mandatory(path.join(this.directory, 'askpass.sh'))
this.runSummary_md = path.join(this.workspace.value, 'run-summary.md')
}

/**
* Tries to restore the Scala Steward workspace build from the cache, if any.
Expand Down
11 changes: 7 additions & 4 deletions src/utils/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ type ActionYaml = {inputs: Record<string, {description: string; default: string

const actionYaml = yaml.load(fs.readFileSync('action.yml', {encoding: 'utf8'})) as ActionYaml

const inputs = Object.entries(actionYaml.inputs).flatMap(input => ['']
.concat(...input[1].description.trimEnd().split('\n').map(line => ` # ${line}`))
.concat(input[1].default ? [' #', ` # Default: ${input[1].default}`] : [])
.concat(` ${input[0]}: ''`),
const inputs = Object.entries(actionYaml.inputs).flatMap(input =>
[
'',
...input[1].description.trimEnd().split('\n').map(line => ` # ${line}`),
...(input[1].default ? [' #', ` # Default: ${input[1].default}`] : []),
` ${input[0]}: ''`,
],
)

/**
Expand Down