Sync Changes to GitOps Repo #19
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: Sync Changes to GitOps Repo | |
on: | |
pull_request: | |
types: [closed] | |
workflow_dispatch: | |
jobs: | |
sync_changes: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.DITP_GITOPS_REPO_SECRET }} | |
- name: Add github.com to known hosts | |
run: ssh-keyscan github.com >> ~/.ssh/known_hosts | |
- name: Checkout GitOps repo | |
uses: actions/checkout@v4 | |
with: | |
repository: bcgov-c/ministry-gitops-ditp | |
ssh-key: ${{ secrets.DITP_GITOPS_REPO_SECRET }} | |
sparse-checkout: | | |
services | |
path: ministry-gitops-ditp | |
- name: Copy changes | |
run: | | |
rsync -avz --delete ./services/ ./ministry-gitops-ditp/services/ | |
- name: Commit and push changes | |
run: | | |
cd ministry-gitops-ditp | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Sync changes from trust-over-ip-configurations" || echo "No changes to commit" | |
git push |