mirror of
https://github.com/haskell-actions/run-ormolu.git
synced 2024-12-01 18:56:02 +03:00
Install Ormolu executable
This commit is contained in:
parent
e1f3ad03e2
commit
e808a7fd8e
24390
dist/index.js
vendored
24390
dist/index.js
vendored
File diff suppressed because one or more lines are too long
54
index.js
54
index.js
@ -1,26 +1,44 @@
|
||||
const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
const tool_cache = require('@actions/tool-cache');
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
// https://github.com/actions/toolkit
|
||||
const ormolu_linux_url = 'https://github.com/tweag/ormolu/releases/download/0.1.3.0/ormolu-Linux';
|
||||
const ormolu_windows_url = 'https://github.com/tweag/ormolu/releases/download/0.1.3.0/ormolu-Windows';
|
||||
const ormolu_macos_url = 'https://github.com/tweag/ormolu/releases/download/0.1.3.0/ormolu-macOS';
|
||||
|
||||
// 1. download ormolu executable using @actions/tool-cache perhaps
|
||||
// https://github.com/tweag/ormolu/releases/download/0.1.3.0/ormolu-Linux
|
||||
// https://github.com/tweag/ormolu/releases/download/0.1.3.0/ormolu-macOS
|
||||
// https://github.com/tweag/ormolu/releases/download/0.1.3.0/ormolu-Windows
|
||||
async function run() {
|
||||
try {
|
||||
|
||||
// 2. grep Haskell files and run ormolu
|
||||
// Download ormolu executable
|
||||
|
||||
// 3. call git to highlight diffs
|
||||
let ormolu_path;
|
||||
|
||||
try {
|
||||
// `who-to-greet` input defined in action metadata file
|
||||
const nameToGreet = core.getInput('who-to-greet');
|
||||
console.log(`Hello ${nameToGreet}!`);
|
||||
const time = (new Date()).toTimeString();
|
||||
core.setOutput("time", time);
|
||||
// Get the JSON webhook payload for the event that triggered the workflow
|
||||
const payload = JSON.stringify(github.context.payload, undefined, 2)
|
||||
console.log(`The event payload: ${payload}`);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
if (process.platform === 'win32') {
|
||||
ormolu_path = await tool_cache.downloadTool(ormolu_windows_url);
|
||||
}
|
||||
else if (process.platform === 'darwin') {
|
||||
ormolu_path = await tool_cache.downloadTool(ormolu_macos_url);
|
||||
}
|
||||
else {
|
||||
ormolu_path = await tool_cache.downloadTool(ormolu_linux_url);
|
||||
}
|
||||
|
||||
// Cache ormolu executable
|
||||
|
||||
const ormolu_cached_path = await tool_cache.cacheFile(ormolu_path);
|
||||
|
||||
// Add ormolu to PATH
|
||||
|
||||
core.addPath(ormolu_cached_path);
|
||||
|
||||
// TODO grep Haskell files and run ormolu
|
||||
|
||||
// TODO call git to highlight diffs
|
||||
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
|
1237
package-lock.json
generated
1237
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -18,8 +18,10 @@
|
||||
"author": "Mark Karpov",
|
||||
"license": "BSD 3 clause",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.0",
|
||||
"@actions/github": "^1.1.0",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.4",
|
||||
"@actions/github": "^4.0.0",
|
||||
"@actions/tool-cache": "^1.6.0",
|
||||
"@vercel/ncc": "^0.24.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
Loading…
Reference in New Issue
Block a user