Publishing Architectural Decision Records to Confluence with GitHub Actions

I’ve long been a fan of Architectural Decision Records as a way to remind our future selves why we did things the way we did.

I think a folder in the repo, alongside the code, is definitely the best place to store them, so that they can be versioned with the code, and are easily accessible to anyone who can view the repo. This also allows the use of the Pull Request mechanism to govern new architectural decisions - and requiring mandatory approvals can go a long way to mitigating “nobody told me we were doing that”.

The problem is that there are invariably some team members for whom looking at GitHub would represent an affront to their “non-technical Agilist” sensibilites. For these team members, it is often convenient to publish the same content elsewhere, in this case to Confluence.

In the example repo accompanying this post I present an Actions workflow that will publish the contents of the doc/adr folder to Confluence:


name: Python application

on:
  push:
    branches: [ "main" ]

permissions:
  contents: read

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    
    - uses: actions/setup-python@v5
      with:
        python-version: '3.12'
        
    - uses: snok/install-poetry@v1
    
    - name: Install dependencies
      run: poetry install --no-interaction 

    - name: Build package
      run: poetry build

    - name: Test with pytest
      run: |
        poetry run pytest        

    - uses: actions/upload-artifact@v4.4.1
      with:
        path: dist/


    - name: publish ADRs to Confluence
      uses: markdown-confluence/publish-action@v5
      with:
        atlassianUserName: ${{ secrets.ATLASSIAN_USERNAME }}
        atlassianApiToken: ${{ secrets.ATLASSIAN_API_TOKEN }}
        configFile: .markdown-confluence.json

The configuration for the markdown-confluence action is in the specified json file:

{
  "confluenceBaseUrl": "https://gavincampbelldotdev.atlassian.net",
  "confluenceParentId": "196832",
  "folderToPublish": "doc/adr"
}

196832 is the ID of the parent page, copied from the url. You can view the page in Confluence here: https://gavincampbelldotdev.atlassian.net/wiki/spaces/markdownpu/pages/196832/Decisions.

This page uses the Child Pages Macro to create a table of contents for our ADRs.

To create a new ADR, we create a new branch, then poetry run adr-new publish ADRs to Confluence (as we are managing dependencies, including adr-tools-python, with poetry).

The pull request for my last ADR is here, and the resulting action run can be viewed here