Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
- stable
- develop

jobs:
test:
name: Run Tests with Coverage
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ['lts/*']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests with coverage
run: npm test
Comment on lines +14 to +35

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 1 month ago

To fix this issue, explicitly declare a permissions block at the most appropriate scope. Since the workflow only reads code and does not require write access, set permissions: contents: read. This can be added at the workflow root (to apply to all jobs) or at the job level (to restrict just this job). Here, add the block at the job level (under test:) for the smallest change, but it is equally correct to do so at the top level. Insert this block directly beneath the name: Run Tests with Coverage line, ensuring no functionality changes. No further imports or definitions are required.


Suggested changeset 1
.github/workflows/test.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -12,6 +12,8 @@
 jobs:
   test:
     name: Run Tests with Coverage
+    permissions:
+      contents: read
     runs-on: ubuntu-latest
 
     strategy:
EOF
@@ -12,6 +12,8 @@
jobs:
test:
name: Run Tests with Coverage
permissions:
contents: read
runs-on: ubuntu-latest

strategy:
Copilot is powered by AI and may make mistakes. Always verify output.
6 changes: 4 additions & 2 deletions .github/workflows/use-shared-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ on:
branches:
- stable

permissions:
contents: write
id-token: write

jobs:
build-and-publish:
if: github.event.pull_request.merged == true
uses: newrelic/video-core-js/.github/workflows/npm-publish.yml@stable
with:
node-version: 'lts/*'
s3-path: 'media-agents/browser/html5'
file-to-upload: 'dist/umd/newrelic-video-html5.min.js'
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2 changes: 2 additions & 0 deletions DATAMODEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ An Attribute is a piece of data associated with an event. Attributes provide add
| totalAdPlaytime | Total time ad is played for this video session. |
| elapsedTime | Time that has passed since the last event. |
| bufferType | When buffer starts, i.e., initial, seek, pause & connection. |
| timeSinceLastError | Time in milliseconds since the last content error occurred. Only included after an error has occurred. |
| asn | Autonomous System Number: a unique number identifying a group of IP networks that serves the content to the end user. |
| asnLatitude | The latitude of the geographic center of the postal code where the Autonomous System Network is registered. This is not the end user's latitude. |
| asnLongitude | The longitude of the geographic center of the postal code where the Autonomous System Network is registered. This is not the end user's longitude. |
Expand Down Expand Up @@ -125,6 +126,7 @@ An Attribute is a piece of data associated with an event. Attributes provide add
| adPartner | The ad partner, e.g., ima, freewheel. |
| isBackgroundEvent | If the player is hidden by another window. |
| bufferType | When buffer starts, i.e., initial, seek, pause & connection. |
| timeSinceLastAdError | Time in milliseconds since the last ad error occurred. Only included after an ad error has occurred. |
| asn | Autonomous System Number: a unique number identifying a group of IP networks that serves the content to the end user. |
| asnLatitude | The latitude of the geographic center of the postal code where the Autonomous System Network is registered. This is not the end user's latitude. |
| asnLongitude | The longitude of the geographic center of the postal code where the Autonomous System Network is registered. This is not the end user's longitude. |
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ As noted in our [security policy](../../security/policy), New Relic is committed

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [our bug bounty program](https://docs.newrelic.com/docs/security/security-privacy/information-security/report-security-vulnerabilities/).

## Pricing

Important: Ingesting video telemetry data via this video agent requires a subscription to an Advanced Compute. Contact your New Relic account representative for more details on pricing and entitlement.

## License

New Relic Html5 Tracker is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.
4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
presets: ["@babel/preset-env"],
plugins: ["@babel/plugin-transform-modules-commonjs"],
};
20 changes: 20 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
testEnvironment: 'node',
moduleFileExtensions: ['js', 'jsx'],
transform: {
'^.+\\.jsx?$': 'babel-jest'
},
transformIgnorePatterns: ['node_modules/(?!@newrelic)/'],
testMatch: ['**/__test__/**/*.js?(x)', '**/?(*.)+(spec|test).js?(x)'],
moduleNameMapper: {
'^@newrelic/video-core$': '@newrelic/video-core/__mock__.js'
},
coverageThreshold: {
global: {
branches: 83,// Current: 83.01% - will increase gradually
functions: 90,
lines: 90,
statements: 90
}
}
};
Loading
Loading