diff --git a/.github/workflows/browser_test.yml b/.github/workflows/browser_test.yml index 0e54fbd..ece59f6 100644 --- a/.github/workflows/browser_test.yml +++ b/.github/workflows/browser_test.yml @@ -47,4 +47,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }} TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }} + SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }} + SBVT_SCM_COMMIT_ID: ${{ github.sha }} DEBUG: TRUE diff --git a/.github/workflows/cypress_version-test.yml b/.github/workflows/cypress_version-test.yml index 3abcc5d..7e975cb 100644 --- a/.github/workflows/cypress_version-test.yml +++ b/.github/workflows/cypress_version-test.yml @@ -69,6 +69,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }} TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }} + SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }} + SBVT_SCM_COMMIT_ID: ${{ github.sha }} DEBUG: TRUE @@ -114,4 +116,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }} TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }} + SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }} + SBVT_SCM_COMMIT_ID: ${{ github.sha }} DEBUG: TRUE \ No newline at end of file diff --git a/.github/workflows/linux_quick-test.yaml b/.github/workflows/linux_quick-test.yaml index 3dc74e5..a14c637 100644 --- a/.github/workflows/linux_quick-test.yaml +++ b/.github/workflows/linux_quick-test.yaml @@ -33,6 +33,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }} TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }} + SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }} + SBVT_SCM_COMMIT_ID: ${{ github.sha }} DEBUG: TRUE diff --git a/.github/workflows/mac_windows_quick-tests.yml b/.github/workflows/mac_windows_quick-tests.yml index 0f8f098..c189721 100644 --- a/.github/workflows/mac_windows_quick-tests.yml +++ b/.github/workflows/mac_windows_quick-tests.yml @@ -31,6 +31,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }} TEST_RUN_NAME: "${{ github.workflow }}—${{ runner.os }}—${{ github.ref }}" + SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }} + SBVT_SCM_COMMIT_ID: ${{ github.sha }} DEBUG: TRUE diff --git a/.github/workflows/npm-package_test.yml b/.github/workflows/npm-package_test.yml index d74d526..7946e14 100644 --- a/.github/workflows/npm-package_test.yml +++ b/.github/workflows/npm-package_test.yml @@ -38,6 +38,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }} TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }} + SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }} + SBVT_SCM_COMMIT_ID: ${{ github.sha }} DEBUG: TRUE diff --git a/.github/workflows/print_report-test.yml b/.github/workflows/print_report-test.yml index f134b06..6702fa7 100644 --- a/.github/workflows/print_report-test.yml +++ b/.github/workflows/print_report-test.yml @@ -30,6 +30,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }} TEST_RUN_NAME: "${{ github.workflow }}—${{ runner.os }}—${{ github.ref }}" + SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }} + SBVT_SCM_COMMIT_ID: ${{ github.sha }} DEBUG: TRUE diff --git a/.github/workflows/typescript-test.yml b/.github/workflows/typescript-test.yml index f781a8d..14b8f2c 100644 --- a/.github/workflows/typescript-test.yml +++ b/.github/workflows/typescript-test.yml @@ -51,6 +51,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }} TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }} + SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }} + SBVT_SCM_COMMIT_ID: ${{ github.sha }} DEBUG: TRUE diff --git a/.github/workflows/webkit-browser_test.yml b/.github/workflows/webkit-browser_test.yml index aa44ebf..06ad596 100644 --- a/.github/workflows/webkit-browser_test.yml +++ b/.github/workflows/webkit-browser_test.yml @@ -37,4 +37,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }} TEST_RUN_NAME: "${{ github.workflow }}—${{ runner.os }}—${{ github.ref }}" + SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }} + SBVT_SCM_COMMIT_ID: ${{ github.sha }} DEBUG: TRUE \ No newline at end of file diff --git a/README.md b/README.md index fdf0906..3c0996a 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,13 @@ module.exports = { // OR save on the environment variable // SBVT_TEST_GROUP_NAME = 'test group name' ``` +## Assigning SCM data to a test run + +Save Source Control Manager data on the environment variable +```bash +SBVT_SCM_BRANCH=branch-name +SBVT_SCM_COMMIT_ID=commit-hash +``` ## Manual Setup diff --git a/plugin.js b/plugin.js index 5ac7589..57ae5f0 100644 --- a/plugin.js +++ b/plugin.js @@ -306,7 +306,10 @@ function makeGlobalRunHooks() { const postResponse = await apiRequest('post', `${configFile.url}/api/v1/projects/${configFile.projectId}/testruns`, { testRunName: configFile.testRunName, sdk: 'cypress', - sdkVersion: `${package_json.version}/c${usersCypress.version}`, ...(!!process.env.SBVT_TEST_GROUP_ID ? {testGroupId: process.env.SBVT_TEST_GROUP_ID} : !!configFile.testGroupName ? {testGroupId: await getCreateTestGroupId(getUsersTestGroupName(configFile.testGroupName), configFile.projectToken)} : {}), + sdkVersion: `${package_json.version}/c${usersCypress.version}`, + ...(!!process.env.SBVT_TEST_GROUP_ID ? {testGroupId: process.env.SBVT_TEST_GROUP_ID} : !!configFile.testGroupName ? {testGroupId: await getCreateTestGroupId(getUsersTestGroupName(configFile.testGroupName), configFile.projectToken)} : {}), + ...(!!process.env.SBVT_SCM_COMMIT_ID ? {scmCommitId: process.env.SBVT_SCM_COMMIT_ID} : {}), + ...(!!process.env.SBVT_SCM_BRANCH ? {scmBranch: process.env.SBVT_SCM_BRANCH} : {}), }); configFile.testRunId = postResponse.data.testRunId; logger.debug('config.testRunId: ' + configFile.testRunId);