我计划在GitHub和AWS codecomcommit同步一个repo。所有当前代码和未来PR合并到main、dev和preprod的代码都应该在AWS代码提交中。我指的是GitHub行动,我看到三个不同的wiki/文档。我不知道该选哪一个?
1. https://github.com/marketplace/actions/github-to-aws-codecommit-sync
2. https://github.com/marketplace/actions/mirroring-repository
3. https://github.com/marketplace/actions/automatic-repository-mirror
第一个(actions/github-to-aws-codecommit-sync
)应该足够了。
它的脚本entrypoint.sh
做一个:
git config --global credential.'https://git-codecommit.*.amazonaws.com'.helper '!aws codecommit credential-helper $@'
git remote add sync ${CodeCommitUrl}
git push sync --mirror
应该拉所有分支,包括PR分支(在refs/pull/
命名空间)
该操作应该在合并的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))
...