diff --git a/.github/workflows/keep-config-intact.yml b/.github/workflows/keep-config-intact.yml index 33ff9db..f8df384 100644 --- a/.github/workflows/keep-config-intact.yml +++ b/.github/workflows/keep-config-intact.yml @@ -3,12 +3,11 @@ on: pull_request: branches: - main + - test types: [opened, synchronize, reopened] - permissions: contents: write pull-requests: write - jobs: restore-config: runs-on: ubuntu-latest @@ -18,22 +17,25 @@ jobs: ref: ${{ github.head_ref }} fetch-depth: 0 - - name: Restore main's _config.yml + - name: Restore target branch's _config.yml run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - # Get main's version of _config.yml - git fetch origin main - git show origin/main:_config.yml > /tmp/main_config.yml + # Get the target branch (main or test) + TARGET_BRANCH="${{ github.base_ref }}" + + # Get target branch's version of _config.yml + git fetch origin "$TARGET_BRANCH" + git show "origin/$TARGET_BRANCH:_config.yml" > /tmp/target_config.yml # Compare with current version - if ! cmp -s _config.yml /tmp/main_config.yml; then - echo "Restoring main's _config.yml to PR branch" - cp /tmp/main_config.yml _config.yml + if ! cmp -s _config.yml /tmp/target_config.yml; then + echo "Restoring $TARGET_BRANCH's _config.yml to PR branch" + cp /tmp/target_config.yml _config.yml git add _config.yml - git commit -m "chore: restore main's _config.yml [automated]" + git commit -m "chore: restore $TARGET_BRANCH's _config.yml [automated]" git push else - echo "✓ _config.yml already matches main's version" + echo "✓ _config.yml already matches $TARGET_BRANCH's version" fi \ No newline at end of file diff --git a/_config.yml b/_config.yml index 3304a6b..9098fdb 100644 --- a/_config.yml +++ b/_config.yml @@ -1,6 +1,6 @@ theme: just-the-docs -baseurl: /Digital-Interfaces # For test branch: /repository-name/test +baseurl: /Digital-Interfaces/test # For test branch: /repository-name/test #theme: just-the-docs title: Digital Interfaces