Skip to content

Commit 0887cb1

Browse files
authored
Merge pull request #2 from comet-ml/CRThaze/test
Cr thaze/test
2 parents 49666a5 + 97b94f6 commit 0887cb1

File tree

8 files changed

+163
-100
lines changed

8 files changed

+163
-100
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Preview README changes
2+
run-name: Preview README changes for ${{ github.ref_name }} by @${{ github.actor }}
3+
on:
4+
pull_request:
5+
paths:
6+
- charts/s3proxy/Chart.yaml
7+
- charts/s3proxy/values.yaml
8+
- README.md.gotmpl
9+
- README.md
10+
11+
jobs:
12+
preview-readme:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
ref: ${{ github.event.pull_request.head.ref }}
19+
20+
- name: Save HEAD SHA before helm-docs
21+
id: save-sha
22+
run: |
23+
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
24+
25+
- name: Render helm docs inside the README.md
26+
uses: losisin/helm-docs-github-action@v1
27+
with:
28+
git-push: false
29+
output-file: ../../README.md
30+
template-files: README.md.gotmpl
31+
32+
- name: Check for README changes
33+
id: check-changes
34+
run: |
35+
if git diff --quiet ${{ steps.save-sha.outputs.sha }} -- README.md
36+
then
37+
echo "has_changes=false" >> $GITHUB_OUTPUT
38+
else
39+
echo "has_changes=true" >> $GITHUB_OUTPUT
40+
fi
41+
42+
- name: Generate diff
43+
id: diff
44+
if: steps.check-changes.outputs.has_changes == 'true'
45+
run: |
46+
echo 'diff<<EOF' >> $GITHUB_OUTPUT
47+
git diff ${{ steps.save-sha.outputs.sha }} -- README.md >> $GITHUB_OUTPUT
48+
echo 'EOF' >> $GITHUB_OUTPUT
49+
50+
- name: Find and hide outdated comments
51+
if: steps.check-changes.outputs.has_changes == 'true'
52+
uses: actions/github-script@v7
53+
with:
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+
script: |
56+
const comments = await github.rest.issues.listComments({
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
issue_number: context.issue.number
60+
});
61+
62+
const botComments = comments.data.filter(comment =>
63+
comment.user.type === 'Bot' &&
64+
comment.body.includes('<!-- helm-docs-preview -->')
65+
);
66+
67+
for (const comment of botComments) {
68+
await github.graphql(`
69+
mutation {
70+
minimizeComment(input: {
71+
subjectId: "${comment.node_id}",
72+
classifier: OUTDATED
73+
}) {
74+
clientMutationId
75+
}
76+
}
77+
`);
78+
}
79+
80+
- name: Post README changes as comment
81+
if: steps.check-changes.outputs.has_changes == 'true'
82+
uses: actions/github-script@v7
83+
env:
84+
DIFF_CONTENT: ${{ steps.diff.outputs.diff }}
85+
with:
86+
github-token: ${{ secrets.GITHUB_TOKEN }}
87+
script: |
88+
// Get the diff from the environment variable to avoid JavaScript syntax issues
89+
const diff = process.env.DIFF_CONTENT;
90+
91+
// Use 4 backticks for the outer fence to safely contain any triple backticks in the diff
92+
const body = `<!-- helm-docs-preview -->
93+
## 📝 README.md Preview
94+
95+
The following changes to \`README.md\` will be applied when this PR is merged:
96+
97+
<details>
98+
<summary>Click to expand diff</summary>
99+
100+
\`\`\`\`diff
101+
${diff}
102+
\`\`\`\`
103+
104+
</details>
105+
106+
> **Note**: This is an automated preview generated by \`helm-docs\`. The changes will be automatically applied upon merge.`;
107+
108+
await github.rest.issues.createComment({
109+
owner: context.repo.owner,
110+
repo: context.repo.repo,
111+
issue_number: context.issue.number,
112+
body: body
113+
});
114+
115+
- name: Hide outdated comments when no changes
116+
if: steps.check-changes.outputs.has_changes == 'false'
117+
uses: actions/github-script@v7
118+
with:
119+
github-token: ${{ secrets.GITHUB_TOKEN }}
120+
script: |
121+
const comments = await github.rest.issues.listComments({
122+
owner: context.repo.owner,
123+
repo: context.repo.repo,
124+
issue_number: context.issue.number
125+
});
126+
127+
const botComments = comments.data.filter(comment =>
128+
comment.user.type === 'Bot' &&
129+
comment.body.includes('<!-- helm-docs-preview -->')
130+
);
131+
132+
for (const comment of botComments) {
133+
await github.graphql(`
134+
mutation {
135+
minimizeComment(input: {
136+
subjectId: "${comment.node_id}",
137+
classifier: OUTDATED
138+
}) {
139+
clientMutationId
140+
}
141+
}
142+
`);
143+
}

.github/workflows/update-readme.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ on:
55
branches:
66
- main
77
paths:
8-
- charts/s3proxy/**
8+
- charts/s3proxy/Chart.yaml
9+
- charts/s3proxy/values.yaml
910
- README.md.gotmpl
1011
- README.md
1112

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
A Helm chart for deploying S3Proxy - Access other storage backends via the S3 API
66

7+
## Maintainers
8+
9+
| Name | Email | Url |
10+
| ---- | ------ | --- |
11+
| CRThaze | | |
12+
713
## Prerequisites
814

915
- Kubernetes 1.19+

charts/s3proxy/Chart.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
apiVersion: v2
22
name: s3proxy
33
description: A Helm chart for deploying S3Proxy - Access other storage backends via the S3 API
4-
maintainers:
5-
- name: CRThaze
64

75
# A chart can be either an 'application' or a 'library' chart.
86
#
@@ -17,7 +15,7 @@ type: application
1715
# This is the chart version. This version number should be incremented each time you make changes
1816
# to the chart and its templates, including the app version.
1917
# Versions are expected to follow Semantic Versioning (https://semver.org/)
20-
version: 0.0.1
18+
version: 0.0.2
2119

2220
# This is the version number of the application being deployed. This version number should be
2321
# incremented each time you make changes to the application. Versions are not expected to

charts/s3proxy/README.md

Lines changed: 0 additions & 95 deletions
This file was deleted.

charts/s3proxy/templates/NOTES.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,18 @@
5151
# Upload a file
5252
aws --endpoint-url http://<SERVICE_URL> s3 cp /path/to/file s3://test-bucket/
5353

54+
5455
# You can also use other AWS S3 API compatible clients like MinIO's mc
56+
mc alias set s3proxy http://<SERVICE_URL> <your-s3proxy-identity> <your-s3proxy-credential>
57+
58+
# List buckets
59+
mc ls s3proxy
60+
61+
# Create a bucket
62+
mc mb s3proxy/test-bucket
63+
64+
# Upload a file
65+
mc cp /path/to/file s3proxy/test-bucket/
5566
{{- end }}
5667

5768
4. Monitoring:

charts/s3proxy/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ ingress:
6969
# - chart-example.local
7070

7171
# -- Resource limits and requests
72-
# @default -- `{}`
7372
resources: {}
7473
# We usually recommend not to specify default resources and to leave this as a conscious
7574
# choice for the user. This also increases chances charts run on environments with little

0 commit comments

Comments
 (0)