-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
48 lines (42 loc) · 1.39 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
name: "run-git-sumi"
description: "Use git-sumi to validate a PR title"
author: "Óscar <osc@osc.garden>"
branding:
icon: 'search'
color: 'purple'
runs:
using: "composite"
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: . # Check out only repository root, where 'sumi.toml' is located.
- name: Download git-sumi binary
shell: bash
run: |
curl -L "https://github.com/welpo/git-sumi/releases/download/v0.0.9/git-sumi-x86_64-unknown-linux-gnu.tar.xz" -o git-sumi.tar.xz
- name: Extract and rename git-sumi binary
shell: bash
run: |
tar -xf git-sumi.tar.xz
mv git-sumi-x86_64-unknown-linux-gnu/git-sumi git-sumi
chmod +x git-sumi
- name: Run git-sumi
env:
PR_TITLE: ${{ github.event.pull_request.title }}
shell: bash
run: |
export GIT_SUMI_QUIET=false
output=$(./git-sumi -f table "${PR_TITLE}")
exit_code=$?
if [ $exit_code -eq 0 ]; then
# Command succeeded. Format the output.
content=$(echo "$output" | awk '/\| Key/,0' | head -n -1)
last_line=$(echo "$output" | tail -n 1)
{
echo "## git-sumi"
echo "$content" # This is the Markdown table.
echo ""
echo "$last_line" # Summary.
} >> "${GITHUB_STEP_SUMMARY}"
fi