Skip to content

Commit e7c4400

Browse files
committed
Add run-cabal-gild action
1 parent dbb6ea6 commit e7c4400

File tree

9 files changed

+1061
-0
lines changed

9 files changed

+1061
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
run-cabal-gild/dist/index.js linguist-generated=true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/node_modules

run-cabal-gild/LICENSE.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
This code is an adaptation of https://github.com/haskell-actions/run-fourmolu
2+
which in turn was an adaptation. Here is the license as included in the
3+
`run-fourmolu` code:
4+
5+
This code was originally written by Mark Karpov for Ormolu:
6+
https://github.com/mrkkrp/ormolu-action. The following is the license for that
7+
code:
8+
9+
Copyright © 2020–2022 Mark Karpov
10+
11+
All rights reserved.
12+
13+
Redistribution and use in source and binary forms, with or without
14+
modification, are permitted provided that the following conditions are met:
15+
16+
* Redistributions of source code must retain the above copyright notice,
17+
this list of conditions and the following disclaimer.
18+
19+
* Redistributions in binary form must reproduce the above copyright
20+
notice, this list of conditions and the following disclaimer in the
21+
documentation and/or other materials provided with the distribution.
22+
23+
* Neither the name Mark Karpov nor the names of contributors may be used to
24+
endorse or promote products derived from this software without specific
25+
prior written permission.
26+
27+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY EXPRESS
28+
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
30+
NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
31+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
33+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
36+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37+
38+
------------------------------------------
39+
40+
The above repo has been updated to work with Fourmolu in this repository.
41+
This new code uses the following license:
42+
43+
Copyright © 2022–present Bitnomial
44+
45+
All rights reserved.
46+
47+
Redistribution and use in source and binary forms, with or without
48+
modification, are permitted provided that the following conditions are met:
49+
50+
* Redistributions of source code must retain the above copyright notice,
51+
this list of conditions and the following disclaimer.
52+
53+
* Redistributions in binary form must reproduce the above copyright
54+
notice, this list of conditions and the following disclaimer in the
55+
documentation and/or other materials provided with the distribution.
56+
57+
* Neither the name Mark Karpov nor the names of contributors may be used to
58+
endorse or promote products derived from this software without specific
59+
prior written permission.
60+
61+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY EXPRESS
62+
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
63+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
64+
NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
65+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
66+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
67+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
68+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
69+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
70+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

run-cabal-gild/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# cabal-gild action
2+
3+
This `run-cabal-gild` GitHub Action helps to ensure that your Haskell project is
4+
formatted with [cabal-gild](https://github.com/tfausak/cabal-gild). The action
5+
tries to find all Cabal source code files in your repository and fails if any
6+
of them are not formatted. In case of failure it prints the diff between the
7+
actual contents of the file and its formatted version.
8+
9+
## Example usage
10+
11+
In the simple case all you need to do is to add this step to your job:
12+
13+
```yaml
14+
- uses: input-output-hk/actions/run-cabal-gild@v1
15+
with:
16+
version: "1.7.0.1"
17+
```
18+
19+
The `1.7.0.1` should be replaced with the version of cabal-gild you want to use. See
20+
[cabal-gild releases](https://github.com/tfausak/cabal-gild/releases) for all cabal-gild versions.
21+
If you don't specify this cabal-gild `version` input, the latest version of
22+
cabal-gild will be used.

run-cabal-gild/action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Run cabal-gild'
2+
description: 'Check formatting of Cabal code with cabal-gild'
3+
inputs:
4+
follow-symbolic-links:
5+
required: false
6+
description: >
7+
Whether to follow symbolic links.
8+
default: true
9+
extra-args:
10+
required: false
11+
description: >
12+
Extra arguments to pass to Fourmolu.
13+
version:
14+
required: false
15+
description: >
16+
The version number of cabal-gild to use. Defaults to "latest". Example
17+
version numbers -- `0.13.0.0`, `0.10.1.0`, etc. See
18+
https://github.com/tfausak/cabal-gild/releases for a list of all releases.
19+
default: latest
20+
working-directory:
21+
description: >
22+
Directory in which to run cabal-gild. This also affects how the `pattern`
23+
argument is interpretted, with Glob patterns being relative to this
24+
`working-directory` argument.
25+
26+
Defaults to the repository root if not set.
27+
required: false
28+
runs:
29+
using: 'node20'
30+
main: 'dist/index.js'

run-cabal-gild/dist/index.js

Lines changed: 255 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)