-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
104 lines (90 loc) · 2.6 KB
/
action.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: "deps-diff"
description: "Clojure dependencies differ"
author: "Hyunwoo Nam"
branding:
icon: "package"
color: "green"
inputs:
base:
required: true
description: git/sha of base commit
default: ${{ github.event.pull_request.base.sha }}
dir:
required: false
description: root directory of deps.edn
default: "."
aliases:
required: false
description: aliases to create basis
default: "nil"
format:
required: false
description: output format. edn (default) OR markdown
outputs:
deps_diff:
description: output in edn format
value: ${{ steps.diff.outputs.DEPS_DIFF }}
exit_code:
description: Result of command (exit code). 0, if no difference.
value: ${{ steps.diff.outputs.EXIT_CODE }}
runs:
using: "composite"
steps:
- name: Prepare java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
cli: 1.11.2.1446
- name: Cache maven
uses: actions/cache@v4
env:
cache-name: cache-clojure
with:
path: |
~/.m2
~/.gitlibs
key: ${{ env.cache-name }}-${{ hashFiles('**/deps.edn') }}
restore-keys: |
${{ env.cache-name }}-
- name: Checkout base
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Resolve base
shell: bash
run: |
DIR=${{ inputs.dir }}
clojure -X:deps tree :dir '"'$DIR'"' :aliases '${{ inputs.aliases }}' :format :edn > __base.edn
- name: Checkout target
uses: actions/checkout@v4
with:
clean: false
- name: Resolve target
shell: bash
run: |
DIR=${{ inputs.dir }}
clojure -X:deps tree :dir '"'$DIR'"' :aliases '${{ inputs.aliases }}' :format :edn > __target.edn
- name: Install deps-diff
shell: bash
run: |
TOOL_PATH=${{ github.action_path }}
clojure -Ttools install io.github.namenu/deps-diff '{:local/root "'$TOOL_PATH'"}' :as deps-diff
- id: diff
shell: bash
run: |
set +e
DEPS_DIFF=$(clojure -Tdeps-diff namenu.tools.deps-diff/diff \
:base '"__base.edn"' \
:target '"__target.edn"' \
:format :${{ inputs.format }})
EXIT_CODE=$?
echo "DEPS_DIFF<<EOF" >> $GITHUB_OUTPUT
echo "$DEPS_DIFF" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "EXIT_CODE=$EXIT_CODE" >> $GITHUB_OUTPUT
# always exit with 0
# exit $EXIT_CODE