Are you looking for an easy way to work with Dataverse? If so, you might find this GitHub workflow helpful. It's basically a mini-git system that syncs your repository with your Dataverse dataset. Here's what it does:
- Pushes all your repository files to your dataset
- Detects any changes and updates your dataset files accordingly
- Removes any files from your dataset that are not in your repository
- Lets you push content to any directory within your dataset.
Hope that helps!
Tip
It is highly recommended to store your API_TOKEN as a secret in your repository to prevent unauthorized users from accessing your datasets. Not sure what secrets are? Find information how to add and use secrets within actions.
Please make sure, that the persistent_id parameter follows Dataverse's pattern doi:<Your DOI> - The following usage provides an example.
# Push to the root of the dataset
- name: Synchronize to DV
uses: SimTech-Research-Data-Management/dataverse-sync@v2
with:
dataverse_url: "https://demo.dataverse.org"
api_token: ${{ secrets.MY_API_TOKEN }}
persistent_id: "doi:10.5072/FK2/ABC123"
# Push to a specific sub directory
- name: Synchronize to DV
uses: SimTech-Research-Data-Management/dataverse-sync@v2
with:
dataverse_url: "https://demo.dataverse.org"
api_token: ${{ secrets.MY_API_TOKEN }}
persistent_id: "doi:10.5072/FK2/ABC123"
directory: "some/sub/dir"| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|---|---|---|---|---|
| api_token | string | true | The API Token used for authentication |
|
| dataverse_url | string | true | The URL of the Dataverse instance. |
|
| directory | string | true | The directory to which the respsitory needs to be synced |
|
| persistent_id | string | true | The persistent ID of the dataset. |
name: Dataverse Sync
# Choose whatever suits your needs
on: [push, release]
jobs:
dv-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Synchronize to DV
uses: SimTech-Research-Data-Management/dataverse-sync@v2
with:
dataverse_url: "Enter your Dataverse URL here"
api_token: ${{ secrets.DV_API_TOKEN }}
persistent_id: "Enter your dataset persistent ID here"