-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
on: [push] | ||
|
||
name: Test Workflow | ||
|
||
jobs: | ||
dvc-code-usages: | ||
runs-on: ubuntu-latest | ||
name: Update code usages | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ./ | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
client-id: ${{ secrets.DVC_CLIENT_ID }} | ||
client-secret: ${{ secrets.DVC_CLIENT_SECRET }} | ||
project-key: default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
name: Fetch DevCycle Code Usages | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: DevCycleHQ/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/****************************************************************************** | ||
* This file is used with workflow.yml is running without errors and usage data | ||
* is sent to the DVC test org. | ||
* | ||
* https://app.devcycle.com/o/org_U9F8YMaTChTEndWw/p/default/variables | ||
******************************************************************************/ | ||
// @ts-nocheck | ||
|
||
import { initialize } from '@devcycle/devcycle-js-sdk' | ||
|
||
// The user object needs either a user_id, or isAnonymous set to true | ||
const user = { user_id: 'my_user' } | ||
let dvcClient | ||
|
||
try { | ||
// Call initialize with the client key and a user object | ||
// await on the features to be loaded from our servers | ||
dvcClient = await initialize('client-123', user) | ||
.onClientInitialized() | ||
|
||
useDVCVariable() | ||
} catch(ex) { | ||
console.log('Error initializing DVC: ${ex}') | ||
} | ||
|
||
function useDVCVariable() { | ||
if (!dvcClient) return | ||
|
||
// Fetch variable values using the identifier key coupled with a default value | ||
// The default value can be of type string, boolean, number, or object | ||
const dvcVariableNumber = dvcClient.variable('test-feature-number', 10) | ||
const dvcVariableString = dvcClient.variable('test-feature-string', '10') | ||
const dvcVariableJson = dvcClient.variable('test-feature-json', {}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters