-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-workflow.yml
More file actions
62 lines (55 loc) · 1.92 KB
/
github-workflow.yml
File metadata and controls
62 lines (55 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: autobean
# Trigger on pull requests, or pushes to the main branch.
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: lint the accounts
runs-on: ubuntu-latest
steps:
- name: check out the repo
uses: actions/checkout@v2
- name: setup docker
uses: docker-practice/actions-setup-docker@v1
- name: run autobean
id: lint
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker run -t --rm \
-v ${{ github.workspace }}:/data \
ghcr.io/datavirke/autobean:main \
/data >> $GITHUB_STEP_SUMMARY
# Remove coloring
sed -i 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' $GITHUB_STEP_SUMMARY
LINT_OUTPUT="$(cat $GITHUB_STEP_SUMMARY)"
LINT_OUTPUT="${LINT_OUTPUT//'%'/'%25'}"
LINT_OUTPUT="${LINT_OUTPUT//$'\n'/'%0A'}"
LINT_OUTPUT="${LINT_OUTPUT//$'\r'/'%0D'}"
echo "Output: $LINT_OUTPUT"
echo "::set-output name=lint::$LINT_OUTPUT"
- name: write lint summary to pull request comment
if: "${{ github.event_name == 'pull_request' && steps.lint.outputs.lint != '' }}"
uses: marocchino/sticky-pull-request-comment@v2
with:
header: autobean-output
recreate: true
message: |
```
${{ steps.lint.outputs.lint }}
````
- name: delete pull request comment
if: "${{ github.event_name == 'pull_request' && steps.lint.outputs.lint == '' }}"
uses: marocchino/sticky-pull-request-comment@v2
with:
header: autobean-output
delete: true
continue-on-error: true
- name: check if any output was produced by the linter
if: "${{ steps.lint.outputs.lint != '' }}"
uses: actions/github-script@v3
with:
script: |
core.setFailed('Linter found errors in the beancount files')