confluence-markdown-sync/README.md

86 lines
2.5 KiB
Markdown
Raw Normal View History

2020-12-13 15:24:52 +00:00
# Confluence Markdown Sync Action
2020-12-13 15:14:13 +00:00
2020-12-13 15:24:52 +00:00
This Github Action serves the purpose of copying the contents of a Markdown `.md` file to a Confluence Cloud Page.
2020-12-13 15:14:13 +00:00
2020-12-13 15:24:52 +00:00
## Getting Started
```yml
# .github/workflows/my-workflow.yml
on: [push]
jobs:
dev:
runs-on: ubuntu-latest
steps:
2020-12-13 15:53:08 +00:00
- uses: actions/checkout@v2
2020-12-13 15:24:52 +00:00
2022-12-08 16:24:06 +00:00
- uses: cupcakearmy/confluence-markdown-sync@v1
2020-12-13 15:53:08 +00:00
with:
from: './README.md'
to: '123456' # The confluence page id where to write the output
cloud: <my-confluence-cloud-id>
user: <my.user@example.org>
token: <my-token>
2020-12-13 15:24:52 +00:00
```
## Authentication
Uses basic auth for the rest api.
- `cloud`: Can be either:
2024-11-28 14:34:59 +00:00
- A subdomain (`acme` for Atlassian hosted instances (e.g. `https://acme.atlassian.net`))
- A full URL (e.g., `https://mycompany.com` for self-hosted instances)
2022-12-08 16:24:06 +00:00
2020-12-13 15:24:52 +00:00
- `user`: The user that generated the access token
2022-12-08 16:24:06 +00:00
2020-12-13 15:24:52 +00:00
- `token`: You can generate the token [here](https://id.atlassian.com/manage-profile/security/api-tokens). Link to [Docs](https://confluence.atlassian.com/cloud/api-tokens-938839638.html)
- `to`: The page ID can be found by simply navigating to the page where you want the content to be posted to and look at the url. It will look something like this:
- For Atlassian hosted: `https://<subdomain>.atlassian.net/wiki/spaces/<space>/pages/<page-id>/<title>`
- For self-hosted: `https://<your-url>/wiki/spaces/<space>/pages/<page-id>/<title>`
2020-12-13 15:44:26 +00:00
2020-12-13 15:45:16 +00:00
### Using secrets
It's **higly reccomended** that you use secrets!
2020-12-13 15:53:08 +00:00
To use them you need them to specify them before in your repo. [Docs](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets)
2023-03-30 08:19:55 +00:00
Then you can use them in any input field.
2020-12-13 15:53:08 +00:00
```yml
# .github/workflows/my-workflow.yml
# ...
token: ${{ secrets.token }}
```
2020-12-13 15:44:26 +00:00
2023-03-30 08:18:10 +00:00
## Known Limitations
For now images will not be uploaded [see ticket](https://github.com/cupcakearmy/confluence-markdown-sync/issues/5), they would require extra steps. If anyone feedls brave enough, constributions are welcomed :)
2020-12-13 15:44:26 +00:00
## Development
1. Clone the repo
2. Install [act](https://github.com/nektos/act)
3. Create the same config in the repo folder as in the getting started section above.
2021-10-27 11:48:10 +00:00
4. Change `uses: cupcakearmy/confluence-markdown-sync` -> `uses: ./`
2020-12-13 15:44:26 +00:00
5. Create an example markdown file `Some.md` and set it in the config `from: './Some.md'`
6. Run locally `act -b`
2020-12-13 15:53:08 +00:00
### With secrets
2021-10-27 11:44:44 +00:00
You can simply create a `.secrets` file and specify it to `act`.
2020-12-13 15:53:08 +00:00
```
2021-10-27 11:44:44 +00:00
TOKEN=abc123
2020-12-13 15:53:08 +00:00
```
```yml
# .github/workflows/dev.yml
# ...
token: ${{ secrets.token }}
```
```bash
act -b --secret-file .secrets
```