-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
59 lines (53 loc) · 2.01 KB
/
action.yaml
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
name: markdown-table-generator
description: A custom action written in Rust which generates markdown tables for use in Locatarr. Based on Dylan Anthony's rust-github-action-template (dbanty/rust-github-action-template).
author: Brenek Harrison <BrenekH@users.noreply.github.com>
inputs:
file-path:
description: "The path to the JSON file to use"
required: true
token:
description: 'The GitHub token to use for downloading the action binary, defaults to workflow token'
required: true
default: ${{ github.token }}
outputs:
output-file:
description: "The path of the generated markdown table file"
value: ${{ steps.run.outputs.outputfile }}
error:
description: 'The description of any error that occurred'
value: ${{ steps.run.outputs.error }}
runs:
using: 'composite'
steps:
- name: Set reusable variables
shell: bash
run: |
echo "action_repo=markdown-table-generator" >> $GITHUB_ENV
echo "action_org=Locatarr" >> $GITHUB_ENV
echo "binary_name=md-table-action" >> $GITHUB_ENV
- name: Add binary extension
shell: bash
if: runner.os == 'Windows'
run: echo "binary_name=${{ env.binary_name }}.exe" >> $GITHUB_ENV
- name: Get Action Version
id: get_action_version
shell: pwsh
run: |
$finalComponent = Split-Path -Leaf ${{ github.action_path }}
if ($finalComponent -eq "${{ env.action_repo }}") {
$version = ""
} else {
$version = $finalComponent
}
Write-Output "version=$version" >> $Env:GITHUB_OUTPUT
- name: Download Action
shell: bash
run: |
gh release download ${{ steps.get_action_version.outputs.version }} --repo ${{ env.action_org }}/${{ env.action_repo }} --pattern '${{ runner.os }}.tar.gz' --clobber
tar -xzf ${{ runner.os }}.tar.gz
env:
GITHUB_TOKEN: ${{ inputs.token }}
- name: Run Action
shell: bash
id: run
run: ./${{ runner.os }}/${{ env.binary_name }} "${{ inputs.file-path }}"