-
Notifications
You must be signed in to change notification settings - Fork 36
38 lines (36 loc) · 1.19 KB
/
sync.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: sync
run-name: ${{ github.actor }} is syncing repo to CodeCommit
on:
push:
branches:
- '**'
tags:
- '*'
workflow_dispatch: {}
jobs:
sync:
if: github.repository_owner == 'aws'
name: Sync to CodeCommit
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT }}:role/${{ secrets.ROLE }}
aws-region: ${{ secrets.REGION }}
- name: Push
run: |
echo "Pushing tag: $GITHUB_REF_NAME"
git config --global --add safe.directory /github/workspace
git config --global credential.'https://git-codecommit.*.amazonaws.com'.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
git remote add code_commit_repo "https://git-codecommit.${{ secrets.REGION }}.amazonaws.com/v1/repos/${{ secrets.REPO }}"
git push code_commit_repo $GITHUB_REF_NAME