Helper to sync repository from GitHub to WVS
The Github sync repository contains a sync-helper tool that helps 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
- Create and configure the sync-helper tool project on WVS.
- 4 variables will be set up in WVS.
- Configure your existing project on GitHub.
- 2 variables will be set up in GitHub.
Although you will not be storing any passwords during this setup, it is still important that the tokens you store are kept secure.
Please follow the instructions carefully to ensure all your secrets remain secure.
Setup
In WVS
- Fork the Github Sync repository that can be found here 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.
-
For security, select the Mask checkbox when adding your
WVS_PAT
andGITHUB_SYNC_SOURCE
variable so the value of the variables do not show up in the logs for each flow.
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
Confirm Sync
If you don’t see any data in WVS, you can check in your GitHub account. Click on the Actions tab from the top to see an action for the sync on the list.
If your action fails, double-check your settings and rerun the job.
How it works
Troubleshooting
Still having problems setting up? For additional support, please reach out to us on our Discord.
Was this helpful?
We would love to hear your feedback, Submit a ticket in our Issue Tracker.