mirror of
https://github.com/apache/superset.git
synced 2026-05-07 08:54:23 +00:00
build: inline external Github Actions to unblock CI (#12241)
* build: inline cached-dependencies to unblock CI * Run E2E on pull_request on;y * Inline all external actions * Checkout needed for internal actions Also fixes pre-commit * Add missing files
This commit is contained in:
40
.github/actions/file-changes-action/src/main.ts
vendored
Normal file
40
.github/actions/file-changes-action/src/main.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import {setFailed as coreSetFailed} from '@actions/core'
|
||||
import {getInputs, inferInput} from './InputHelper'
|
||||
import {writeOutput, writeFiles, sortChangedFiles} from './FilesHelper'
|
||||
import {getChangedFiles, initClient} from './GithubHelper'
|
||||
import {errorMessage} from './UtilsHelper'
|
||||
// figure out if it is a PR or Push
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
// get inputs
|
||||
const inputs = getInputs()
|
||||
// parse input
|
||||
const inferred = inferInput(
|
||||
inputs.pushBefore,
|
||||
inputs.pushAfter,
|
||||
inputs.prNumber
|
||||
)
|
||||
// prepare client
|
||||
const client = initClient(inputs.githubToken)
|
||||
// get changed files
|
||||
const changedFilesArray = await getChangedFiles(
|
||||
client,
|
||||
inputs.githubRepo,
|
||||
inferred
|
||||
)
|
||||
// sort changed files
|
||||
const changedFiles = sortChangedFiles(changedFilesArray)
|
||||
Object.keys(changedFiles).forEach(key => {
|
||||
// write file output
|
||||
writeFiles(inputs.fileOutput, key, changedFiles[key])
|
||||
// write output vars
|
||||
writeOutput(inputs.output, key, changedFiles[key])
|
||||
})
|
||||
} catch (error) {
|
||||
const pError = JSON.parse(error.message)
|
||||
coreSetFailed(errorMessage(pError.from, pError))
|
||||
throw new Error(JSON.stringify(pError))
|
||||
}
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
if (!(process.env.INPUT_MOCK === 'true')) run()
|
||||
Reference in New Issue
Block a user