An open API service indexing awesome lists of open source software.

https://github.com/coryodaniel/sacred

A CLI to sync markdown to the Confluence REST API
https://github.com/coryodaniel/sacred

Last synced: about 2 months ago
JSON representation

A CLI to sync markdown to the Confluence REST API

Awesome Lists containing this project

README

          

# Sacred

Keep Github Wiki's, READMEs, or any other markdown files in sync with Confluence pages.

Sacred is configured with a manifest file that allows you to upload multiple confluence documents composed of many markdown files.

Currently a confluence document needs to exist (`contentId`) for Sacred to update it. Sacred _will not_ (currently) create new documents.

## Installation

```
go get -u github.com/coryodaniel/sacred
```

## Usage

By default sacred looks for `.sacred.yaml` in the current directory.

```
sacred upload

# Specify an alternate config path

sacred upload -c path/to/my/config.yaml
```

### Config Examples

#### Single Confluence document from a single markdown file

```yaml
auth:
token: CONFLUENCE_API_TOKEN
domain: your-domain.atlassian.net
docs:
- name: My first document # This will update the Confluence document name
spaceId: CONFLUENCE_SPACE_ID
contentId: CONFLUENCE_CONTENT_ID
files:
- ./README.md
```

#### Multiple Confluence Documents with multiple markdown files

```yaml
auth:
token: CONFLUENCE_API_TOKEN
domain: your-domain.atlassian.net
docs:

- name: My first document
# notice: will set a notice at the top of the generated HTML
notice: DO NOT EDIT! This file is autogenerated from https://my-repo
spaceId: CONFLUENCE_SPACE_ID
contentId: CONFLUENCE_CONTENT_ID_1
files:
- ./README.md
- ./CONTRIBUTORS.md

- name: Another document
spaceId: CONFLUENCE_SPACE_ID
contentId: CONFLUENCE_CONTENT_ID_2
files:
- ./README.md
- ./wiki/intro-to-widgets.md
- ./wiki/advanced-widgetry.md
# globs will be appened in alphabetical order and will not include files listed above
- ./wiki/*.md
```

Additionally the following environment variables may be set:

* `SACRED_TOKEN` - Override `auth.token`
* `SACRED_DOMAIN` - Override `auth.domain`

## Creating a Confluence API Token

Create an API token from your Atlassian account:

1. Log in to https://id.atlassian.com.
2. Click API tokens
3. Then Create API token

This token can either be set in your `.sacred.yaml` file or in the `SACRED_TOKEN` environment variable.

## Confluence Content and Space Identifiers

The content and space ID can be found in the content URL:

`https://YOUR_DOMAIN.atlassian.net/wiki/spaces/SPACE_ID/pages/CONTENT_ID/Markdown+Test`