Skip to content

Commit c4494b6

Browse files
patch: Add _sync_docs.yaml (#157)
[DPE-3641](https://warthogs.atlassian.net/browse/DPE-3641): Add discourse-gatekeeper to data-platform-workflows. ## Description Adding `sync-docs.yaml` workflow that uses discourse-gatekeeper action to sync discourse docs to its corresponding GitHub repository. - described by [`deusebio/discourse-gatekeeper/readme.md`](https://github.com/deusebio/discourse-gatekeeper/blob/c8adb89ea1cbceca54d78da798658373615487ac/README.md) - sample usage in [`mysql-operator/.../sync_docs.yaml`](https://github.com/canonical/mysql-operator/blob/c7e57c086055aef58bb887f1b581cba27fb60af1/.github/workflows/sync_docs.yaml) ## Changes - New file: `_sync_docs.yaml` - New file: `sync_docs.md` - Update: README.md [DPE-3641]: https://warthogs.atlassian.net/browse/DPE-3641?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --------- Co-authored-by: Carl Csaposs <[email protected]>
1 parent 848879c commit c4494b6

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

.github/workflows/_sync_docs.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Workflow file: [_sync_docs.yaml](_sync_docs.yaml)
2+
3+
> [!WARNING]
4+
> Subject to **breaking changes on patch release**. `_sync_docs.yaml` is experimental & not part of the public interface.
5+
6+
## Usage
7+
Add `.yaml` file to `.github/workflows/`
8+
9+
```yaml
10+
# Copyright 2024 Canonical Ltd.
11+
# See LICENSE file for licensing details.
12+
name: Sync docs from Discourse
13+
14+
on:
15+
workflow_dispatch:
16+
schedule:
17+
- cron: # Refer to Run schedule below
18+
push:
19+
branches:
20+
- main
21+
22+
jobs:
23+
sync-docs:
24+
name: Sync docs from Discourse
25+
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
26+
secrets:
27+
discourse_api_username: ${{ secrets.DISCOURSE_API_USERNAME }}
28+
discourse_api_key: ${{ secrets.DISCOURSE_API_KEY }}
29+
permissions:
30+
contents: write # Needed to push branch & tag
31+
pull-requests: write # Needed to create PR
32+
```
33+
34+
## Run schedule
35+
### SQL
36+
| repository | run time | cron |
37+
|:-------------------------:|:--------:|:-------------:|
38+
| mysql-k8s-operator | 12:00 AM | `00 00 * * *` |
39+
| mysql-operator | 12:10 AM | `10 00 * * *` |
40+
| mysql-test-app | 12:20 AM | `20 00 * * *` |
41+
| mysql-router-k8s-operator | 12:30 AM | `30 00 * * *` |
42+
| mysql-router-operator | 12:40 AM | `40 00 * * *` |
43+
| postgresql-k8s-operator | 12:50 AM | `50 00 * * *` |
44+
| postgresql-operator | 01:00 AM | `00 01 * * *` |
45+
| postgresql-test-app | 01:10 AM | `10 01 * * *` |
46+
| pgbouncer-k8s-operator | 01:20 AM | `20 01 * * *` |
47+
| pgbouncer-operator | 01:30 AM | `30 01 * * *` |
48+
49+
### NoSQL
50+
| repository | run time | cron |
51+
|:------------------------------:|:--------:|:-------------:|
52+
| mongodb-k8s-operator | 01:40 AM | `40 01 * * *` |
53+
| mongodb-operator | 01:50 AM | `50 01 * * *` |
54+
| mongos-operator | 02:00 AM | `00 02 * * *` |
55+
| opensearch-k8s-operator | 02:10 AM | `10 02 * * *` |
56+
| opensearch-operator | 02:20 AM | `20 02 * * *` |
57+
| opensearch-dashboards-operator | 02:30 AM | `30 02 * * *` |
58+
| redis-k8s-operator | 02:40 AM | `40 02 * * *` |
59+
| redis-operator | 02:50 AM | `50 02 * * *` |
60+
61+
### Big Data
62+
| repository | run time | cron |
63+
|:---------------------------------:|:--------:|:-------------:|
64+
| kafka-k8s-operator | 03:00 AM | `00 03 * * *` |
65+
| kafka-operator | 03:10 AM | `10 03 * * *` |
66+
| kafka-test-app | 03:20 AM | `20 03 * * *` |
67+
| zookeeper-k8s-operator | 03:30 AM | `30 03 * * *` |
68+
| zookeeper-operator | 03:40 AM | `40 03 * * *` |
69+
| spark-history-server-k8s-operator | 03:50 AM | `50 03 * * *` |
70+
| spark-client-snap | 04:00 AM | `00 04 * * *` |
71+
72+
### Other
73+
| repository | run time | cron |
74+
|:------------------:|:--------:|:-------------:|
75+
| data-integrator | 04:10 AM | `10 04 * * *` |
76+
| s3-integrator | 04:20 AM | `20 04 * * *` |
77+
| data-platform-libs | 04:30 AM | `30 04 * * *` |

.github/workflows/_sync_docs.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
on:
2+
workflow_call:
3+
secrets:
4+
discourse-api-user:
5+
description: Discourse API username
6+
required: true
7+
discourse-api-key:
8+
description: Discourse API key
9+
required: true
10+
11+
jobs:
12+
sync-docs:
13+
name: Sync Discourse docs
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 15
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- name: Open PR with changes to Discourse topics
20+
uses: deusebio/discourse-gatekeeper@c8adb89ea1cbceca54d78da798658373615487ac
21+
id: docs-pr
22+
with:
23+
discourse_host: discourse.charmhub.io
24+
discourse_api_username: ${{ secrets.discourse-api-user }}
25+
discourse_api_key: ${{ secrets.discourse-api-key }}
26+
github_token: ${{ secrets.GITHUB_TOKEN }}
27+
dry_run: "true"
28+
- name: Show migrate output
29+
run: echo '${{ steps.docs-pr.outputs.migrate }}'
30+
- name: Show reconcile output
31+
run: echo '${{ steps.docs-pr.outputs.reconcile }}'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
| [release_charm.yaml](.github/workflows/release_charm.md) | Release charm to Charmhub |
1313
| [update_bundle.yaml](.github/workflows/update_bundle.md) | Update charm revisions in bundle |
1414
| [sync_issue_to_jira.yaml](.github/workflows/sync_issue_to_jira.md) | Sync GitHub issues to Jira issues |
15+
| [_sync_docs.yaml](.github/workflows/_sync_docs.md) | **Experimental** Sync Discourse documentation to GitHub |
1516

1617
### Version
1718
Recommendation: pin the latest version (e.g. `v1.0.0`) and use [Renovate](https://docs.renovatebot.com/) to stay up-to-date.

0 commit comments

Comments
 (0)