Skip to content

Commit

Permalink
fix: docs, sample, repo adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickHeneise committed Mar 15, 2023
1 parent e69a5c6 commit 0af30a1
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 10 deletions.
Binary file added .github/assets/featured-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,53 @@
# Grafana Backup
# Grafana Backup Action

This is a simple script to backup Grafana dashboards.
<p align="center">
<img src=".github/assets/featured-image.jpg">
</p>

[![Publish](https://github.com/zentered/grafana-backup/actions/workflows/publish.yml/badge.svg)](https://github.com/zentered/grafana-backup/actions/workflows/publish.yml)

This is a simple GitHub Action to backup Grafana Cloud dashboards.

## Usage

- `GRAFANA_CLOUD_API_KEY` - your Grafana Cloud API key
- `GRAFANA_ORG` - the Grafana organization name
- `OUTPUT_FOLDER` - the folder to save the dashboards to (ie: `backup`)
- `OVERWRITE_FILES` - true to overwrite/update files, false to create
date-stamped sub-folders

### GitHub Actions

Create a new repository and add the following workflow file to
`.github/workflows/grafana-backup.yml`:

```
name: Grafana Backup
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
jobs:
grafana-backup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Grafana Backup
uses: zentered/[email protected]
env:
GRAFANA_CLOUD_API_KEY: ${{ secrets.GRAFANA_CLOUD_API_KEY }}
GRAFANA_ORG: '<your-org>'
OUTPUT_FOLDER: ''
OVERWRITE_FILES: true
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
```

### Local

Add your API key and the organization name to `.env` (see `.env.example`).

Run `pnpm start` to backup all dashboards to `backup`.
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
branding:
color: blue
icon: bar-chart-2
description: 'Grafana Backup'
name: Grafana Backup
description: 'Run scheduled or triggered backups of your Grafana Cloud instance'
name: Grafana Backup Action
runs:
main: dist/index.js
using: node16
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const grafanaOrg = process.env.GRAFANA_ORG
export const grafanaApiKey = process.env.GRAFANA_CLOUD_API_KEY
export const outputFolder = process.env.OUTPUT_FOLDER
export const overwriteFiles = process.env.OVERWRITE_FILES === 'true'
export const overwriteFiles = process.env.OVERWRITE_FILES === 'false'
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@ try {
const grafanaOrg = process.env.GRAFANA_ORG
const grafanaApiKey = process.env.GRAFANA_CLOUD_API_KEY
const outputFolder = process.env.OUTPUT_FOLDER
const overwriteFiles = process.env.OVERWRITE_FILES === 'true'
const overwriteFiles = process.env.OVERWRITE_FILES === 'false'


/***/ }),
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@zentered/grafana-backup",
"name": "@zentered/grafana-backup-action",
"version": "1.0.0",
"private": false,
"description": "Fetches Grafana dashboards and saves them to a local directory",
Expand All @@ -8,11 +8,11 @@
],
"homepage": "https://zentered.co/",
"bugs": {
"url": "https://github.com/zentered/grafana-backup/issues"
"url": "https://github.com/zentered/grafana-backup-action/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/zentered/grafana-backup.git"
"url": "git+https://github.com/zentered/grafana-backup-action.git"
},
"license": "MIT",
"author": "Patrick Heneise <[email protected]> (https://zentered.co)",
Expand Down

0 comments on commit 0af30a1

Please sign in to comment.