# Setting Up a New Confluence Project Follow these steps to use this template for a new Confluence space. ## 1. Clone the Template ```bash git clone https://github.com/DoctoDre/Confluence_Bot.git my-new-confluence-project cd my-new-confluence-project # Remove the original remote and set your own git remote remove origin git remote add origin https://github.com/YOUR_USER/my-new-confluence-project.git ``` ## 2. Configure ### Set your Confluence details Edit `config.ps1`: ```powershell $ConfluenceUrl = "https://your-confluence-instance.com" $SpaceKey = "YOUR_SPACE_KEY" $RootPageId = "123456789" # Find this in the page URL ``` ### Set your token ```bash cp .secrets.example .secrets # Edit .secrets and paste your Personal Access Token ``` **How to get a PAT:** - Confluence Cloud: Profile → Settings → Personal Access Tokens → Create - Confluence Server: Profile → Personal Access Tokens → Create ## 3. Test Connection ```powershell powershell -ExecutionPolicy Bypass -File scripts/confluence-check.ps1 ``` If successful, you'll see a list of child pages under your root page. ## 4. Initial Export (Optional) ```powershell powershell -ExecutionPolicy Bypass -File scripts/confluence-export.ps1 ``` This downloads the entire page tree for local analysis. ## 5. Push Content Create markdown files in `/pages/`: ``` pages/ ├── 01-overview.md ├── 02-architecture.md └── 03-roadmap.md ``` Then push: ```powershell powershell -ExecutionPolicy Bypass -File scripts/confluence-push.ps1 ``` ## 6. Set Up CI/CD (Optional) ### GitHub Actions Add these secrets to your repo: - `CONFLUENCE_TOKEN` — your PAT Create `.github/workflows/confluence-push.yml`: ```yaml name: Push to Confluence on: push: paths: ['pages/**'] workflow_dispatch: {} jobs: push: runs-on: windows-latest steps: - uses: actions/checkout@v4 - name: Write secrets run: | "CONFLUENCE_TOKEN=${{ secrets.CONFLUENCE_TOKEN }}" | Out-File .secrets -Encoding UTF8 - name: Push pages run: powershell -ExecutionPolicy Bypass -File scripts/confluence-push.ps1 ``` ### GitLab CI Add `CONFLUENCE_TOKEN` as a CI/CD variable, then create `.gitlab-ci.yml`: ```yaml push-confluence: stage: deploy tags: [windows] only: changes: - pages/** script: - echo "CONFLUENCE_TOKEN=$CONFLUENCE_TOKEN" > .secrets - powershell -ExecutionPolicy Bypass -File scripts/confluence-push.ps1 ``` ## 7. Push to Your Repo ```bash git add -A git commit -m "Initial setup for my Confluence space" git push -u origin main ``` ## Tips - **Page titles** come from the first `# Heading` in each markdown file - **Idempotent** — running push multiple times won't create duplicates - **Version tracking** — only updates pages when content actually changed - **Safe** — never deletes pages unless you explicitly use the delete function