Skip to content

Edit a structured config file to generate a html page, then push it to confluence using your PAT

Notifications You must be signed in to change notification settings

evrardjp/confluence-pusher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

# 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

About

Edit a structured config file to generate a html page, then push it to confluence using your PAT

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages