-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
85 lines (59 loc) · 2.24 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Confluence page updater
## How to use the standard page updater
Set Environment Variables CONFLUENCE_PAT and CONFLUENCE_URL:
bash
export CONFLUENCE_PAT="your_personal_access_token"
export CONFLUENCE_URL="https://your-confluence-site.atlassian.net/wiki/rest/api/content/"
Create or Update the Configuration File, config.json
Ensure config.json contains the array of pages with the required fields (page ID, title, version, and HTML file path).
{
"pages": [
{
"page_id": "12345678",
"page_title": "Updated Page Title 1",
"version": 2,
"html_file": "path/to/your-file1.html"
},
{
"page_id": "87654321",
"page_title": "Updated Page Title 2",
"version": 3,
"html_file": "path/to/your-file2.html"
}
// Add more pages as needed
]
}
Run the Code:
Open a terminal and navigate to the directory containing the file.
Run the code using the command:
bash
go run main.go
## How to use the templated page updated
Set Environment Variables CONFLUENCE_PAT and CONFLUENCE_URL:
bash
export CONFLUENCE_PAT="your_personal_access_token"
export CONFLUENCE_URL="https://your-confluence-site.atlassian.net/wiki/rest/api/content/"
Create or Update a page.yaml in yaml_files/
Each YAML file will contain page-specific data, and the templates will be used to generate the HTML files.
Each YAML file should contain the fields required to generate the HTML files and the fields needed for uploading the pages to Confluence.
common_data:
key1: value1
key2: value2
id_card_template:
page_id: "12345678"
page_title: "Page Title 1"
version: 2
specific_field_1: "Some data for template 1"
specific_field_2: "Another data for template 1"
detailed_template:
page_id: "87654321"
page_title: "Page Title 2"
version: 3
specific_field_3: "Some data for template 2"
specific_field_4: "Another data for template 2"
Define the two templates in templates/
Run the Code:
Open a terminal and navigate to the directory containing the file.
Run the code using the command:
bash
go run generate_and_upload.go