mirror of
https://github.com/haskell-actions/run-ormolu.git
synced 2024-11-29 12:22:17 +03:00
Define inputs, do globbing for source files
This commit is contained in:
parent
e808a7fd8e
commit
f9be58ffc0
5
.github/workflows/ci.yaml
vendored
5
.github/workflows/ci.yaml
vendored
@ -12,7 +12,4 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Hello world action step
|
||||
uses: mrkkrp/ormolu-action@master
|
||||
with:
|
||||
who-to-greet: 'Mona the Octocat'
|
||||
- uses: mrkkrp/ormolu-action@master
|
||||
|
16
action.yml
16
action.yml
@ -1,10 +1,18 @@
|
||||
name: 'Ormolu'
|
||||
description: 'Check formatting of Haskell code with Ormolu'
|
||||
inputs:
|
||||
who-to-greet:
|
||||
description: 'Who to greet'
|
||||
required: true
|
||||
default: 'World'
|
||||
pattern:
|
||||
required: false
|
||||
description: >
|
||||
Glob pattern that are used to find source files to format. It is
|
||||
possible to specify several patterns by putting each on a new line.
|
||||
default: |
|
||||
*.hs
|
||||
**/*.hs
|
||||
extra-args:
|
||||
required: false
|
||||
description: >
|
||||
Extra arguments to pass to Ormolu.
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
|
2177
dist/index.js
vendored
2177
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
18
index.js
18
index.js
@ -2,17 +2,22 @@ const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
const tool_cache = require('@actions/tool-cache');
|
||||
const exec = require('@actions/exec');
|
||||
const glob = require('@actions/glob');
|
||||
|
||||
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';
|
||||
const ormolu_version = '0.1.3.0';
|
||||
|
||||
const input_pattern = core.getInput('pattern');
|
||||
const input_extra_args = core.getInput('extra-args');
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
|
||||
// Download ormolu executable
|
||||
|
||||
let ormolu_path;
|
||||
var ormolu_path;
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
ormolu_path = await tool_cache.downloadTool(ormolu_windows_url);
|
||||
@ -26,15 +31,20 @@ async function run() {
|
||||
|
||||
// Cache ormolu executable
|
||||
|
||||
const ormolu_cached_path = await tool_cache.cacheFile(ormolu_path);
|
||||
const ormolu_cached_path = await tool_cache.cacheFile(ormolu_path, 'ormolu', 'ormolu', ormolu_version);
|
||||
|
||||
// Add ormolu to PATH
|
||||
|
||||
core.addPath(ormolu_cached_path);
|
||||
|
||||
// TODO grep Haskell files and run ormolu
|
||||
// Glob for the files to format
|
||||
|
||||
// TODO call git to highlight diffs
|
||||
const globber = await glob.create(input_pattern);
|
||||
const files = await globber.glob();
|
||||
|
||||
// // TODO grep Haskell files and run ormolu
|
||||
|
||||
// // TODO call git to highlight diffs
|
||||
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
36
package-lock.json
generated
36
package-lock.json
generated
@ -28,6 +28,15 @@
|
||||
"@octokit/plugin-rest-endpoint-methods": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"@actions/glob": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.0.tgz",
|
||||
"integrity": "sha512-lx8SzyQ2FE9+UUvjqY1f28QbTJv+w8qP7kHHbfQRhphrlcx0Mdmm1tZdGJzfxv1jxREa/sLW4Oy8CbGQKCJySA==",
|
||||
"requires": {
|
||||
"@actions/core": "^1.2.0",
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"@actions/http-client": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.9.tgz",
|
||||
@ -155,11 +164,30 @@
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.24.1.tgz",
|
||||
"integrity": "sha512-r9m7brz2hNmq5TF3sxrK4qR/FhXn44XIMglQUir4sT7Sh5GOaYXlMYikHFwJStf8rmQGTlvOoBXt4yHVonRG8A=="
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||
},
|
||||
"before-after-hook": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
|
||||
"integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"deprecation": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
|
||||
@ -170,6 +198,14 @@
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
|
@ -21,6 +21,7 @@
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.4",
|
||||
"@actions/github": "^4.0.0",
|
||||
"@actions/glob": "^0.1.0",
|
||||
"@actions/tool-cache": "^1.6.0",
|
||||
"@vercel/ncc": "^0.24.1"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user