Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-muino-garcia committed Jul 5, 2024
0 parents commit 87714fe
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 0 deletions.
5 changes: 5 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# LICENSE

All rights reserved by YepCode.

This repository is a component of the YepCode Platform. By accessing, downloading, installing, or using any part of the YepCode Platform, including this repository, you agree to abide by the [YepCode Terms of Service](https://yepcode.io/terms-of-use). If you do not consent to the YepCode Terms of Service, you are not permitted to access, download, install, or use any part of the YepCode Platform, including this repository.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# YepCode Copy Team GitHub Action

This repo contains a GitHub Action that copies all the contents from the current git repository to one YepCode remote team.

This ensures seamless data transfer and synchronization between teams. Ideal for managing team migrations, duplicating environments, or maintaining consistent setups across multiple YepCode teams.

## Inputs

```yml
inputs:
teamSlug:
description: |
Remote team slug to push contents. It may be a single string (for https://cloud.yepcode.io teams), or a full URL (for on-premise teams)
required: true
clientId:
description: |
Team auth Client ID (for oauth, to be used with Client Secret)
clientSecret:
description: |
Team auth Client ID Client Secret (for oauth, to be used with Client ID)
email:
description: |
team auth Email (to be used wi th password)
password:
description: |
team auth Password (to be used with email)
updateMetadataWithNewRemote:
description: |
It 'true', the action will perform a commit in the current repo with the changes in the .'yepcode.json' metadata file. This will allow then to check sync status agains this remote.
required: false
default: "false"
```
## Usage
```yml
name: Pull Request
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
linting:
runs-on: ubuntu-latest
permissions:
# Needed if updateMetadataWithNewRemote is enabled
contents: write
steps:
- name: YepCode Copy Team
uses: yepcode/gha-copy-team@v1
with:
teamSlug: your-yepcode-team
authEmail: yepcode-sync-user-email
authPassword: yepcode-sync-user-password
```
64 changes: 64 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 'YepCode Copy Team GitHub Action'
description: 'This action syncs YepCode teams by copying resources from the current git repository to another YepCode remote team.'
author: 'YepCode Team ([email protected])'
inputs:
teamSlug:
description: |
Remote team slug to push contents. It may be a single string (for https://cloud.yepcode.io teams), or a full URL (for on-premise teams)
required: true
clientId:
description: |
Team auth Client ID (for oauth, to be used with Client Secret)
clientSecret:
description: |
Team auth Client ID Client Secret (for oauth, to be used with Client ID)
email:
description: |
Team auth Email (to be used wi th password)
password:
description: |
Team auth Password (to be used with email)
updateMetadataWithNewRemote:
description: |
It 'true', the action will perform a commit in the current repo with the changes in the .'yepcode.json' metadata file. This will allow then to check sync status agains this remote.
required: false
default: "false"
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Use Node 20
uses: actions/setup-node@v4
with:
node-version: '20.12'
- name: Install YepCode CLI
shell: bash
run: npm install -g @yepcode/cli
- name: YepCode Login
run: |
URL=`echo ${{ inputs.teamSlug }} | grep -Eo '(https?://[^ >]+)/' | head -1 || true`
clientId=${{ inputs.clientId }}
clientSecret=${{ inputs.clientSecret }}
email=${{ inputs.email }}
password=${{ inputs.password }}
`echo yepcode login ${URL:+-u $URL} ${clientId:+-c $clientId} ${clientSecret:+-s $clientSecret} ${email:+-e $email} ${password:+-p $password}`
shell: bash
- name: YepCode Push
shell: bash
run: |
yepcode remote:add ${{ inputs.teamSlug }}
yepcode add
yepcode push --force
- if: ${{ inputs.updateMetadataWithNewRemote == 'true' }}
name: Update repo with .yepcode.json changes
uses: yepcode/git-auto-commit-action@v5
with:
commit_message: (Automated) Update .yepcode.json after YepCode Copy Team to ${{ inputs.teamSlug }}
file_pattern: '.yepcode.json'
repository: .
branding:
icon: 'download'
color: 'blue'

0 comments on commit 87714fe

Please sign in to comment.