Skip to content

Commit 343a674

Browse files
authored
feat: implement handling duplicate dashboards in same folder (#50)
* fix: handle duplicates when overite is set to true * use title instead of slug * add test cases * add github pr/release actions * add pr template * update pr checker * add overwrite args and help * rename to grafyaml for consistency * implement overwrite arg * use overwrite as default state * improve render script * add pagination to search db
1 parent b23ea7d commit 343a674

File tree

18 files changed

+662
-107
lines changed

18 files changed

+662
-107
lines changed

.github/pull_request_template.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Description
2+
3+
_A concise summary of the changes._
4+
5+
## Why?
6+
7+
_The reason for this change._
8+
9+
## How?
10+
11+
_A brief explanation of how the changes were implemented._
12+
13+
## Checklist
14+
15+
- [ ] I have performed a self-review of my own code
16+
- [ ] I have added or updated relevant tests
17+
- [ ] I have updated the documentation (if necessary)
18+
19+
## Type of change
20+
21+
- [ ] Bug fix (non-breaking change which fixes an issue)
22+
- [ ] New feature (non-breaking change which adds functionality)
23+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
24+
- [ ] Documentation update
25+
- [ ] Other (please specify):

.github/workflows/.releaserc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"verifyConditions": ["@semantic-release/changelog", "@semantic-release/git"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
"@semantic-release/changelog",
7+
"@semantic-release/git",
8+
"@semantic-release/github"
9+
],
10+
"branches": ["+([0-9])?(.{+([0-9]),x}).x", "master"]
11+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: PR checker
2+
3+
on:
4+
pull_request:
5+
branches: [master, main]
6+
types: [opened, edited, labeled, unlabeled, synchronize]
7+
8+
jobs:
9+
pr-checker:
10+
name: Validate pull request
11+
runs-on: [ubuntu-latest]
12+
steps:
13+
- name: Run check
14+
uses: transferwise/actions-pr-checker@v3
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
PR_TITLE_CONTAINS_PATTERN: "^(chore|fix|feat): .*"
18+
PR_COMMENT: |
19+
The title of your PR does not match the expected format. It **must** always contain the following types: chore, fix, feat, docs, style, refactor or test.
20+
21+
✅ Correct examples:
22+
* chore: my cool PR
23+
* chore: #1234, #1234: chore with issue number
24+
* fix: my cool bugfix
25+
* fix: #1234, #1234: fix with issue number
26+
* feat: my cool bugfix
27+
* feat: #1234, #1234: with issue number
28+
29+
❌ Wrong examples:
30+
* My cool feature
31+
* WAL-0 my cool feature

.github/workflows/release.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Semantic Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
semantic-release:
10+
name: Semantic Release
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
persist-credentials: false
21+
22+
- uses: actions/setup-node@v3
23+
with:
24+
node-version: "lts/*"
25+
26+
- name: Semantic Release
27+
uses: cycjimmy/semantic-release-action@v2
28+
id: semantic # Need an `id` for output variables
29+
with:
30+
semantic_version: 17
31+
extra_plugins: |
32+
@semantic-release/changelog@5
33+
@semantic-release/exec@5
34+
@semantic-release/git@9
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Do something when a new release published
39+
if: steps.semantic.outputs.new_release_published == 'true'
40+
run: |
41+
echo ${{ steps.semantic.outputs.new_release_version }}
42+
echo ${{ steps.semantic.outputs.new_release_major_version }}
43+
echo ${{ steps.semantic.outputs.new_release_minor_version }}
44+
echo ${{ steps.semantic.outputs.new_release_patch_version }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ __pycache__
1818
examples/advanced/rendered_dashboards/*.yaml
1919

2020
/venv3
21-
.venv/
21+
*venv/
22+
*vscode/
23+
*conf

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ RUN /output/install-from-bindep
2828
# may optionally supply GRAFANA_APIKEY.
2929
# Mount the dashboards at /grafana.
3030

31-
ENTRYPOINT /usr/local/bin/grafana-dashboard --debug --grafana-url="${GRAFANA_URL}" ${GRAFANA_APIKEY:+--grafana-apikey "$GRAFANA_APIKEY"} update /grafana
31+
ENTRYPOINT /usr/local/bin/grafyaml --debug --grafana-url="${GRAFANA_URL}" ${GRAFANA_APIKEY:+--grafana-apikey "$GRAFANA_APIKEY"} update /grafana

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Sync it to Grafana:
3535
3636
```
3737
export GRAFANA_API_KEY="API_KEY_HERE"
38-
grafana-dashboard --grafana-url https://my-grafana-host.domain.com update my-example-dashboard.yaml
38+
grafyaml --grafana-url https://my-grafana-host.domain.com update my-example-dashboard.yaml
3939
```
4040

4141
## More examples

0 commit comments

Comments
 (0)