merge??? #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Distribute Changes | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-subtrees: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
module: ['terraform-backend-manager'] | |
steps: | |
- name: Checkout main repository | |
uses: actions/checkout@v4 | |
- name: Set up Git | |
run: | | |
git config --unset-all http.https://github.com/.extraheader | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
# - name: Add the target repo as a subtree | |
# run: | | |
# git remote add ${{matrix.module}} https://github.com/Apollo-XIV/${{matrix.module}}.git | |
# git fetch ${{matrix.module}} | |
# git subtree add --prefix=${{matrix.module}} ${{matrix.module}} main --squash || echo "Subtree already exists, skipping add." | |
- name: Pull latest changes from the target repo | |
run: | | |
git subtree merge --prefix=${{matrix.module}} https://$GITHUB_ACTOR:${{secrets.PERSONAL_ACCESS_TOKEN}}@github.com/Apollo-XIV/${{matrix.module}}.git main | |
- name: Push changes back to target repo | |
run: | | |
git subtree push --prefix=${{matrix.module}} https://$GITHUB_ACTOR:${{secrets.PERSONAL_ACCESS_TOKEN}}@github.com/Apollo-XIV/${{matrix.module}}.git main | |
- name: Clean up remotes | |
run: git remote remove ${{matrix.module}} |