This template repository provides a working example of how to use the snapshot export and import features to deploy changes to your production Descope project.
You can use this repo to:
- Keep a source controlled copy of your project settings and configurations
- Use a workflow to export snapshots from a staging project and create a pull request
- Code review changes in pull requests before they are approved and merged
- Automatically deploy changes after pull requests are merged to import them into your production project
- Customize the workflows as you see fit
You can press the Use this template button to create a copy of this repository for use with your Descope project in your own GitHub account. You can of course also clone or fork the repo.
If you're already using Descope you'll need some information from the Descope console, otherwise you can start using Descope in less than a minute.
- You'll need a Descope project and its
Project ID, which you can find in the Project page in the Descope console. - The instructions below assume you have another Descope project, and they'll be referred to as the
stagingandproductionprojects. - You'll also need to generate a management key in the Company page.
The workflows need a Descope management key so they can call the snapshot export and import APIs. They also need to know which Descope projects they're working with. The easiest way to do this is to set these values as secrets and variables in our GitHub repository.
- In your repo's
Settingspage, go toSecrets and variablesand add a repository secret calledMANAGEMENT_KEYwith the value of the key created above.
- Optional: Suppose you have restricted the management key access to your production project, creating a management key within the Descope console that only has access to the production project. In that case, you can also add
PRODUCTION_MANAGEMENT_KEYas a secret. IfPRODUCTION_MANAGEMENT_KEYis configured, it will be used for production actions, andMANAGEMENT_KEYwill be used for staging actions
- Switch to the
Variablestab. - Create a repository variable called
PRODUCTION_PROJECT_IDvariable and set it to theProject IDof yourproductionDescope project. - Do the same thing with a
STAGING_PROJECT_IDvariable and set it to theProject IDof yourstagingDescope project.
The workflows need to be allowed to create pull requests and update the repository.
- In your repo's
Settingspage, go toActionsand selectGeneralon the side panel. - Scroll to the
Workflow permissionssection. - Make sure the
Read and write permissionsoption is selected. - Make sure the
Allow GitHub Actions to create and approve pull requestsoption is checked.
At first, the repository will be empty. We'll want to get the current of the Descope project into the repository.
- Go to the
Actionspage in your repo. - Select the
Create Pull Request from Staging Projectworkflow. - Press the
Run workflowbutton and confirm. - After a short while a new Pull Request will be created.
- You can confirm that the added files contain your
stagingproject's settings and configurations. - Approve and merge the Pull Request to trigger an automatic deployment into your
productionproject.
You should now see a ProjectSnapshot folder in the repo with files representing all the settings and configurations of your project. Note that the path where the files are stored can be customized in the workflow files.
You can now try to introduce a small change to your staging project by going to the Descope console and changing a setting. After that you can repeate the steps above and observe that the diff in the created Pull Request reflects the change that you made.





