Socket
Socket
Sign inDemoInstall

data-update-github

Package Overview
Dependencies
25
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    data-update-github

A remote data change triggers the issue of a pull request to a specified Github repo.


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

data-update-github

A remote data change triggers the issue of a pull request to a specified Github repository.

Install

Run npm ci to install all dependencies.

Linting

Run npm run lint to lint.

Tests

Run npm run test to run tests.

Git operation API Tests

Note that tests for Git operation API (tests/gitOpsApiTests.js) is not included in npm run test command. This test requires a personal access token that has the privilege to operate inclusive-design/data-update-github. This access token can be supplied by defining an environment variable named "ACCESS_TOKEN" or passed as an argument when running the script node tests/gitOpsApiTests.js {access_token}.

Define Environment Variables

Create a .env at the root directory with a content:

ACCESS_TOKEN={String}

Scripts

Auto update ODC data files

  • Script: scripts/fetchODCDataFiles.js

  • Goal: Check if a new version of the open dataset documenting COVID-19 assessment centre locations has been published on the Ontario Data Catalogue API. If the dataset has been updated, this script downloads the file, updates the corresponding latest.json, and commits them into COVID assessment centres data repository.

  • Prerequisites: Tasks below need to complete before running the script:

    • Define an environment variable ACCESS_TOKEN: The personal access token of a Github account that commits will be issued on behalf. Refer to the Github documentation about how to create a Github personal access token.
    • Visit the config file to set proper config values. Purpose of these values are explained in the config file.
  • How to run: node scripts/fetchODCDataFiles.js

Git Operation API

  • Script: scripts/gitOpsApi.js

Includes API for operating remote Github branches and files. All API functions return a promise. Refer to the JSDoc in the script for the detail of parameters.

  • getBranchRef(octokit, options)
  • getAllBranches(octokit, options)
  • createBranch(octokit, options)
  • deleteBranch(octokit, options)
  • fetchRemoteFile(octokit, options)
  • createSingleFile(octokit, options)
  • updateSingleFile(octokit, options)
  • commitMultipleFiles(octokit, options)
  • issuePullRequest(octokit, options)

FAQs

Last updated on 07 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc