-
Notifications
You must be signed in to change notification settings - Fork 107
82 lines (70 loc) · 2.58 KB
/
check-generated-helm-documentation.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
name: Check Generated Helm documentation
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
generated-helm-documentation:
name: Check Generated Helm Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: "${{ github.event.pull_request.head.sha }}"
persist-credentials: false
- name: Setup helm-docs
run: |
version=1.11.0
arch=x86_64
curl -LO https://github.com/norwoodj/helm-docs/releases/download/v${version}/helm-docs_${version}_linux_${arch}.tar.gz
tar -zxvf helm-docs_${version}_linux_${arch}.tar.gz
sudo mv helm-docs /usr/local
- name: Run the automatic generation of helm-docs
working-directory: ./deployments/liqo
run: |
/usr/local/helm-docs -o new_README.md -t README.gotmpl
- name: Gather the helm-docs differences
id: helm-docs-diff
working-directory: ./deployments/liqo
run: |
output=$(diff README.md new_README.md | head -n 100 )
exit_code=$([ "${output}" ] && echo 1 || echo 0)
# Required to correctly manage multi-line outputs
output="${output//'%'/'%25'}"
output="${output//$'\n'/'%0A'}"
output="${output//$'\r'/'%0D'}"
# Store the different as step output
echo "diff=${output}" >> $GITHUB_OUTPUT
# Trigger a failure in case the diff is not empty
exit ${exit_code}
- name: Log the error if the diff is not empty (in case the comment cannot be generated)
run: |
echo "The Helm README.md appear to be out-of-date."
echo
echo "Here it is an excerpt of the diff:"
echo "${{ steps.helm-docs-diff.outputs.diff }}"
if: failure()
- name: Issue a comment in case the diff is not empty
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CI_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
The Helm README.md appears to be out-of-date.
Please, run
```
make docs
```
<details>
<summary>Here it is an excerpt of the diff:</summary>
```diff
${{ steps.helm-docs-diff.outputs.diff }}
```
</details>
reactions: confused
if: |
github.event_name != 'push' && failure() &&
github.event.pull_request.head.repo.full_name == github.repository