Enhance GitHub Actions workflow and permissions

Updated GitHub Actions workflow to include permissions and modified installation command for mdcms. Changed directory handling for building sections to use a loop instead of hardcoded values.
This commit is contained in:
Kristian Benestad 2026-05-18 16:57:01 +07:00 committed by GitHub
parent 3858307302
commit c7ddf32720
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,6 +32,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
@ -94,6 +96,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
@ -102,11 +106,11 @@ jobs:
python-version: "3.12"
- name: Install mdcms
run: pip install mdcms
run: pip install git+https://github.com/kbenestad/mdcms.git
- name: Build all sections
run: |
for section in [DIRECTORY1] [DIRECTORY2] [DIRECTORY3] [DIRECTORY4]; do
for section in docs legal learning reception sysadmin; do
cd $section
mdcms build
cd ..
@ -116,15 +120,12 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/nav.yml docs/search.json legal/nav.yml legal/search.json learning/nav.yml learning/search.json sysadmin/nav.yml sysadmin/search.json
for section in docs legal learning reception sysadmin; do
git add $section/nav.yml $section/search.json
done
git diff --staged --quiet || git commit -m "Build: update nav.yml and search.json"
git push
```
**IMPORTANT:** Please take note of the `run` part, where each directory is listed:
```bash
for section in [DIRECTORY1] [DIRECTORY2] [DIRECTORY3] [DIRECTORY4]; do
```
This is different from the single site workflow. If you move from single site to multisite you need to updated the entire script -- it is not sufficient to just list the paths!
This is different from the single site workflow. If you move from single site to multisite you need to updated the entire script -- it is not sufficient to just list the paths!