Helper to sync repository from GitHub to WVS
This repository provides a tool to help you set up a one-way mirror from your GitHub Repository to a new repository on WVS so you can continue using GitHub and still take advantage of the automation features of WVS.
Setup Overview
To get the GitHub bridge to sync, it will require a total of six variables.
- 2 variables will be set up in your Git Repo
- 4 Variables will be set up in WVS
Please remember that you will not be sharing or storing passwords, and everything you store on WVS is encrypted in our database. Personal Access tokens are used in place of a password to allow you to set limitations on what can be accessed and allow you to revoke at any time.
Setup
In WVS
- Fork this repo to the group or namespace you want to store your mirrored repository by clicking the Fork button on the project homepage.
- Next, grab information for two new variables. The table below gives you a breakdown of how to find the information.
In GitHub
- Go to your GitHub account and select the project you plan to bridge so we can get started on adding the two new variables from step 2 to your GitHub project:
- Under Settings -> Secrets and Variables -> Actions
- Click New Repository Secret
- Add
WVS_PROJECT_ID
andWVS_TRIGGER_TOKEN
with the value from Step 2
- Generate GitHub Personal Access Token
You will need this token for step 5 as the GITHUB_PAT
portion of the GITHUB_SYNC_SOURCE
variable.
*Optional You can use the Fine-grained tokens if it's available for you but since that is still in Beta, we are using the the classic token.
In WVS
- Add four new Variables to your WVS project:
- In WVS Under Project Settings -> CI/CD -> Variables
- Please Note all variables set in WVS are stored encrypted within our database.
In GitHub
- GitHub Action
- Add a GitHub action to your project to trigger the sync.
This is just a text-based yml file in your Github repository.
ex: .github/workflows/wvs-sync.yml
:
You can grab the working example here or copy the example below.
name: WVSTrigger
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the branches specified
push:
pull_request:
branches: [ "main", "wvs-sync" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger WVS Pipeline
env:
WVS_TRIGGER_TOKEN: ${{ secrets.WVS_TRIGGER_TOKEN }}
WVS_PROJECT_ID: ${{ secrets.WVS_PROJECT_ID }}
run: |
echo "Triggering pipeline at https://wvs.io/api/v4/projects/${WVS_PROJECT_ID}/trigger/pipeline"
curl -D - -XPOST --fail -F token=${WVS_TRIGGER_TOKEN} -F ref=main https://wvs.io/api/v4/projects/${WVS_PROJECT_ID}/trigger/pipeline