Warn and make Gradle Wrapper script executable

Instead of failing the build, detect a non-executable wrapper file
and set the executable bit.

Fixes #17
This commit is contained in:
daz
2024-02-08 21:58:12 -07:00
parent dfd22334ff
commit 2f23d645f2
10 changed files with 386 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import * as core from '@actions/core'
import * as path from 'path'
import fs from 'fs'
@@ -37,6 +38,9 @@ function verifyIsExecutableScript(toExecute: string): void {
try {
fs.accessSync(toExecute, fs.constants.X_OK)
} catch (err) {
throw new Error(`Gradle script '${toExecute}' is not executable.`)
core.warning(
`Gradle wrapper script '${toExecute}' is not executable. Action will set executable permission and continue.`
)
fs.chmodSync(toExecute, '755')
}
}