Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Github Actions to mirror and sync with AWS codecommit

I am planning to Synchronize a repo in GitHub and to AWS codecommit. All the present code and future PR’s merging to main, dev, and preprod should be in the AWS codecommit. I am referring to GitHub Actions and I see three different wiki/documentation. I am not sure which one to follow?

1.https://github.com/marketplace/actions/github-to-aws-codecommit-sync

2.https://github.com/marketplace/actions/mirroring-repository

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

3.https://github.com/marketplace/actions/automatic-repository-mirror

>Solution :

The first one (actions/github-to-aws-codecommit-sync) should be enough.

Its script entrypoint.sh does a:

git config --global credential.'https://git-codecommit.*.amazonaws.com'.helper '!aws codecommit credential-helper $@'
git remote add sync ${CodeCommitUrl}
git push sync --mirror

That should pull all branches, including PR branches (in refs/pull/ namespace)

That action should be called on merged PR:

name: OnMergedPR
on:
  push:
    branches:
      - "**"
      - "!main"

  pull_request:
    branches:
      - main
    types: [opened, synchronize, closed]

  workflow_dispatch: 

jobs:   
  build:
    if: (!(github.event.action == 'closed' && github.event.pull_request.merged != true))

...
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading