Skip to content

Commit 0de1a89

Browse files
committed
Fixes Create reusable Github action
#361
1 parent 76dacca commit 0de1a89

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

.github/actions/dfetch-action.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
# Dfetch SARIF Check Action
3+
# =========================
4+
#
5+
# This action installs dfetch, runs `dfetch check --sarif`, and uploads the SARIF file for code scanning.
6+
#
7+
# ## Usage Example
8+
#
9+
# ```yaml
10+
# jobs:
11+
# dfetch-scan:
12+
# runs-on: ubuntu-latest
13+
# steps:
14+
# - uses: actions/checkout@v4
15+
# - name: Run Dfetch SARIF Check
16+
# uses: dfetch-org/dfetch/.github/actions/dfetch-action@main
17+
# with:
18+
# dfetch-install: '.'
19+
# working-directory: '.' # optional, defaults to project root
20+
# ```
21+
#
22+
# ## Inputs
23+
# - `dfetch-install`: pip install argument for dfetch (default: . for local)
24+
# - `working-directory`: Directory to run dfetch in (default: project root)
25+
#
26+
# ## Outputs
27+
# - `sarif-path`: Path to the generated SARIF file (sarif.json)
28+
#
29+
# ## Author
30+
# - Maintained by dfetch-org
31+
name: 'Dfetch SARIF Check'
32+
description: 'Run dfetch check and upload SARIF results.'
33+
author: 'dfetch-org'
34+
branding:
35+
icon: 'check-circle'
36+
color: 'blue'
37+
38+
inputs:
39+
dfetch-install:
40+
description: 'pip install argument for dfetch (default: . for local)'
41+
required: false
42+
default: '.'
43+
working-directory:
44+
description: 'Directory to run dfetch in (default: project root)'
45+
required: false
46+
default: '.'
47+
48+
outputs:
49+
sarif-path:
50+
description: 'Path to the generated SARIF file.'
51+
value: sarif.json
52+
53+
runs:
54+
using: 'composite'
55+
steps:
56+
- name: Setup Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.13'
60+
- name: Install dfetch
61+
run: pip install ${{ inputs.dfetch-install }}
62+
shell: bash
63+
- name: Run dfetch check (SARIF)
64+
run: dfetch check --sarif sarif.json
65+
shell: bash
66+
working-directory: ${{ inputs.working-directory }}
67+
- name: Upload SARIF file
68+
uses: github/codeql-action/upload-sarif@v3
69+
with:
70+
sarif_file: sarif.json

0 commit comments

Comments
 (0)