-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
71 lines (65 loc) · 2.23 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
60
61
62
63
64
65
66
67
68
69
70
71
# action.yaml
# SPDX-FileCopyrightText: 2024 Ali Sajid Imami
#
# SPDX-License-Identifier: MIT
name: "REUSE Compliance Checker"
description: "A GitHub Action to check if a repository is compliant with the REUSE specification."
author: "Ali Sajid Imami"
branding:
icon: "check-circle"
color: "green"
# Define inputs for configuring the action
inputs:
token:
description: "GitHub token for repository access if needed."
required: false
default: "${{ github.token }}"
repo-path:
description: "Path to the repository where we run the helper tool"
required: true
default: "."
# Define outputs to provide a summary of compliance
outputs:
compliance_status:
description: "Returns 'compliant' or 'non-compliant' based on REUSE compliance check."
value: ${{ steps.output_status.compliance_status }}
compliance_report:
description: "Detailed output of the REUSE compliance check."
value: ${{ steps.output_report.compliance_report }}
# Define the action runs using composite
runs:
using: "composite"
steps:
- name: Check Environment Sanity
id: env_sanity
shell: bash
run: |
echo "Checking that the environment is sane"
echo "Python Version: $( python --version )"
echo "Pipx Version: $( pipx --version )"
echo "jq Version: $( jq --version )"
- name: Setup REUSE helper tool
id: reuse_setup
uses: threeal/pipx-install-action@b0bf0add7d5aefda03a3d4e47d651df807889e10 # v1.0.0
with:
packages: reuse
- name: Run REUSE for linting
id: run_reuse
shell: bash
working-directory: ${{inputs.repo-path}}
run: reuse lint --json | tee reuse_results.json
continue-on-error: true
- name: Output Compliance Report
id: output_report
shell: bash
working-directory: ${{inputs.repo-path}}
run: |
compliance_report=$(cat reuse_results.json | jq @json )
echo "compliance_report=$compliance_report" >> $GITHUB_OUTPUT
- name: Output Compliance Status
id: output_status
shell: bash
working-directory: ${{inputs.repo-path}}
run: |
command_status=$(cat reuse_results.json | jq '.summary.compliant')
echo "compliance_status=$command_status" >> $GITHUB_OUTPUT