Skip to content

Update config.yml

Update config.yml #66

name: Ensure correct CMS branch
on:
push:
branches:
- main
- dev
paths:
- src/admin/config.yml # Skip this action unless the Netlify CMS config file has changed.
jobs:
ensure-cms-branch:
runs-on: ubuntu-latest
env:
target_branch: "dev" # Default to dev branch
steps:
- uses: actions/checkout@v4
- name: Adjust target branch for environment
if: endsWith(github.ref, '/main') # If the commit is in
run: |
echo "target_branch=main" >> $GITHUB_ENV
- name: Update CMS branch configuration
uses: mikefarah/yq@v4.43.1
with:
cmd: yq eval -i '.backend.branch = "${{ env.target_branch }}"' src/admin/config.yml
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update CMS branch configuration"
file_pattern: src/admin/config.yml