Skip to content

Commit

Permalink
feat: add v2 action.yml support
Browse files Browse the repository at this point in the history
  • Loading branch information
wei committed Apr 23, 2020
1 parent f5f2380 commit 02caad7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
FROM alpine

LABEL "com.github.actions.name"="Git Sync Action"
LABEL "com.github.actions.description"="🔃 Sync between two independent repositories"
LABEL "com.github.actions.icon"="git-branch"
LABEL "com.github.actions.color"="black"

LABEL "repository"="http://github.com/wei/git-sync"
LABEL "homepage"="http://github.com/wei/git-sync"
LABEL "maintainer"="Wei He <[email protected]>"
Expand Down
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: repo-sync
uses: wei/git-sync@v1
env:
SOURCE_REPO: ""
SOURCE_BRANCH: ""
DESTINATION_REPO: ""
DESTINATION_BRANCH: ""
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
uses: wei/git-sync@v2
with:
args: $SOURCE_REPO $SOURCE_BRANCH $DESTINATION_REPO $DESTINATION_BRANCH
source_repo: ""
source_branch: ""
destination_repo: ""
destination_branch: ""
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
```
`SSH_PRIVATE_KEY` can be omitted if using authenticated HTTPS repo clone urls like `https://username:[email protected]/username/repository.git`.
`ssh_private_key` can be omitted if using authenticated HTTPS repo clone urls like `https://username:[email protected]/username/repository.git`.

#### Advanced: Sync all branches

To Sync all branches from source to destination, use `SOURCE_BRANCH: "refs/remotes/source/*"` and `DESTINATION_BRANCH: "refs/heads/*"`. But be careful, branches with the same name including `master` will be overwritten.
To Sync all branches from source to destination, use `source_branch: "refs/remotes/source/*"` and `destination_branch: "refs/heads/*"`. But be careful, branches with the same name including `master` will be overwritten.

#### Advanced: Sync all tags

To Sync all tags from source to destination, use `SOURCE_BRANCH: "refs/tags/*"` and `DESTINATION_BRANCH: "refs/tags/*"`. But be careful, tags with the same name will be overwritten.
To Sync all tags from source to destination, use `source_branch: "refs/tags/*"` and `destination_branch: "refs/tags/*"`. But be careful, tags with the same name will be overwritten.

### Docker
```
Expand Down
32 changes: 32 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Git Sync Action
author: Wei He <[email protected]>
description: 🔃 Sync between two independent repositories
branding:
icon: 'git-branch'
color: 'gray-dark'
inputs:
source_repo:
description: GitHub repo slug or full clone url
required: true
source_branch:
description: Branch name to sync from
required: true
destination_repo:
description: GitHub repo slug or full clone url
required: true
destination_branch:
description: Branch name to sync to
required: true
ssh_private_key:
description: SSH key used to authenticate with git clone urls provided (optional if public or https clone url with authentication)
required: false
runs:
using: 'docker'
image: 'Dockerfile'
env:
SSH_PRIVATE_KEY: ${{ inputs.ssh_private_key }}
args:
- ${{ inputs.source_repo }}
- ${{ inputs.source_branch }}
- ${{ inputs.destination_repo }}
- ${{ inputs.destination_branch }}

0 comments on commit 02caad7

Please sign in to comment.