-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
63 lines (56 loc) · 1.86 KB
/
action.yml
File metadata and controls
63 lines (56 loc) · 1.86 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
63
name: 'Altern Open Data Compiler'
description: 'Validate and build awesome list from YAML data files'
author: 'alternbits'
branding:
icon: 'list'
color: 'blue'
inputs:
data-dir:
description: 'Directory containing data YAML files'
required: false
default: 'data'
meta-dir:
description: 'Directory containing meta/info.yml and meta/categories.yml'
required: false
default: 'meta'
fail-if-outdated:
description: 'Fail if the generated output file differs from the committed version'
required: false
default: 'true'
outputs:
output-path:
description: 'Absolute path to the generated readme file'
value: ${{ steps.output-path.outputs.output-path }}
runs:
using: 'composite'
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: false
- name: Build compiler
shell: bash
run: go build -o opendata-compiler .
working-directory: ${{ github.action_path }}/compiler
- name: Run compiler
shell: bash
run: |
"${{ github.action_path }}/compiler/opendata-compiler" \
-data "${{ inputs.data-dir }}" \
-meta "${{ inputs.meta-dir }}"
working-directory: ${{ github.workspace }}
- name: Set output path
id: output-path
shell: bash
run: |
OUTPUT=$("${{ github.action_path }}/compiler/opendata-compiler" -print-out)
echo "output-path=$OUTPUT" >> $GITHUB_OUTPUT
working-directory: ${{ github.workspace }}
- name: Check output file is up to date
if: ${{ inputs.fail-if-outdated == 'true' }}
shell: bash
run: |
OUTPUT="${{ steps.output-path.outputs.output-path }}"
git diff --exit-code "$OUTPUT" || (echo "::error::$OUTPUT is out of date. Run the compiler locally and commit the changes." && exit 1)
working-directory: ${{ github.workspace }}