This repository has been archived by the owner on May 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copied github package from https://github.com/Financial-Times/tooling…
- Loading branch information
Braimbridge, Adam
authored and
Braimbridge, Adam
committed
Mar 4, 2019
1 parent
4dd30a5
commit ae14335
Showing
31 changed files
with
1,594 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
circleci-node-10: | ||
docker: | ||
- image: circleci/node:10.15.2 | ||
working_directory: ~/project/build | ||
|
||
commands: | ||
npm-install: | ||
description: "npm install without generating a package-lock file" | ||
steps: | ||
- run: | ||
name: "Install project dependencies" | ||
command: npm install --no-package-lock | ||
|
||
references: | ||
|
||
# | ||
# Workspace | ||
# | ||
|
||
workspace_root: &workspace_root | ||
~/project | ||
|
||
attach_workspace: &attach_workspace | ||
attach_workspace: | ||
at: *workspace_root | ||
|
||
# | ||
# Cache keys | ||
# | ||
cache_keys_root: &cache_keys_root | ||
keys: | ||
- cache-root-v1-{{ .Branch }}-{{ checksum "./package.json" }} | ||
|
||
# | ||
# Cache creation | ||
# | ||
|
||
create_cache_root: &create_cache_root | ||
save_cache: | ||
key: cache-root-v1-{{ .Branch }}-{{ checksum "./package.json" }} | ||
paths: | ||
- ./node_modules/ | ||
|
||
# | ||
# Cache restoration | ||
# | ||
|
||
restore_cache_root: &restore_cache_root | ||
restore_cache: | ||
<<: *cache_keys_root | ||
|
||
# | ||
# Filters | ||
# | ||
|
||
filters_branch_build: &filters_branch_build | ||
tags: | ||
ignore: /.*/ | ||
|
||
filters_release_package_build: &filters_release_package_build | ||
tags: | ||
only: | ||
- /^[a-z\-]+-v\d+\.\d+\.\d+(\-\w+\.\d+)?$/ | ||
branches: | ||
ignore: /.*/ | ||
|
||
jobs: | ||
|
||
build: | ||
executor: circleci-node-10 | ||
steps: | ||
- checkout | ||
- *restore_cache_root | ||
- npm-install | ||
- *create_cache_root | ||
- persist_to_workspace: | ||
root: *workspace_root | ||
paths: | ||
- build | ||
|
||
test: | ||
executor: circleci-node-10 | ||
steps: | ||
- *attach_workspace | ||
- run: | ||
name: Run tests | ||
command: npm test | ||
|
||
publish: | ||
executor: circleci-node-10 | ||
steps: | ||
- *attach_workspace | ||
- run: | ||
name: Configure registry.npmjs.org auth token | ||
command: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > ${HOME}/.npmrc | ||
- run: | ||
name: Extract package name and semver from git tag | ||
command: | | ||
# https://circleci.com/docs/2.0/env-vars/#using-bash_env-to-set-environment-variables | ||
export RELEASE_SEMVER='v[0-9]{1,3}\.[0-9]{1,2}\.[0-9]{1,2}(-[a-z]+\.[0-9])?'; | ||
export TARGET_VERSION=$(echo $CIRCLE_TAG | grep -o -E $RELEASE_SEMVER); | ||
export TARGET_MODULE=$(echo $CIRCLE_TAG | sed -E "s/-${RELEASE_SEMVER}//g"); | ||
echo "export TARGET_VERSION=$TARGET_VERSION" >> $BASH_ENV; | ||
echo "export TARGET_MODULE=$TARGET_MODULE" >> $BASH_ENV; | ||
echo "Creating release ${TARGET_VERSION} for ${TARGET_MODULE}"; | ||
- run: | ||
name: Bump package version | ||
command: npx athloi -F ${TARGET_MODULE} version ${TARGET_VERSION} | ||
- run: | ||
name: Publish package to npm | ||
command: npx athloi -F ${TARGET_MODULE} publish -- --access=public | ||
|
||
workflows: | ||
|
||
version: 2 | ||
|
||
build-test: | ||
jobs: | ||
- build: | ||
filters: | ||
<<: *filters_branch_build | ||
- test: | ||
filters: | ||
<<: *filters_branch_build | ||
requires: | ||
- build | ||
|
||
build-test-publish: | ||
jobs: | ||
- build: | ||
filters: | ||
<<: *filters_release_package_build | ||
- test: | ||
filters: | ||
<<: *filters_release_package_build | ||
requires: | ||
- build | ||
- publish: | ||
filters: | ||
<<: *filters_release_package_build | ||
requires: | ||
- test |
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 @@ | ||
_extends: github-apps-config-next |
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 @@ | ||
_extends: github-apps-config-next |
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,84 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# Generated files | ||
package-lock.json | ||
test-results/ |
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 @@ | ||
10.15.2 |
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,4 @@ | ||
# See https://help.github.com/articles/about-code-owners/ for more information | ||
# about this file. | ||
|
||
* @adambraimbridge |
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 |
---|---|---|
@@ -1,2 +1,52 @@ | ||
# github | ||
This package is a wrapper around the official GitHub REST API client for JavaScript [@octokit/rest](https://github.com/octokit/rest.js) - it exposes a library and a command line interface (CLI). | ||
|
||
This package is a wrapper around the official GitHub REST API client for | ||
JavaScript [@octokit/rest](https://github.com/octokit/rest.js) - it exposes a | ||
library and a command line interface (CLI). | ||
|
||
_Note:_ Requires a [GitHub personal access token](#github-personal-access-token-security) | ||
for GitHub API requests that require authentication. | ||
|
||
## Usage | ||
|
||
### Library | ||
|
||
``` | ||
npm install @financial-times/github | ||
``` | ||
|
||
```javascript | ||
const github = require('@financial-times/github')({ | ||
personalAccessToken: process.env.GITHUB_PERSONAL_ACCESS_TOKEN | ||
}); | ||
``` | ||
|
||
See [`examples/examples.js`](examples/examples.js) for a full set of | ||
usage examples. | ||
|
||
See [`src/index.js`](src/index.js) for all available methods. | ||
|
||
### Command line interface (CLI) | ||
|
||
``` | ||
$ npx @financial-times/github --help | ||
github <command> | ||
Commands: | ||
github project:add-pull-request Add a pull request to a project | ||
github project:create Create a new project | ||
github pull-request:create Create a new pull request | ||
Options: | ||
--version Show version number [boolean] | ||
--help Show help [boolean] | ||
``` | ||
|
||
## GitHub personal access token security | ||
|
||
<!-- TODO: Update the wording --> | ||
|
||
Some of the tooling helpers require a GitHub personal access token with all | ||
`repo` scopes. This is _very powerful_ as it has access to modify a | ||
repository's settings, so it is strongly recommended that you follow the guide | ||
on [How to store and access a GitHub personal access token securely](https://github.com/Financial-Times/next/wiki/How-to-store-and-access-a-GitHub-personal-access-token-securely). |
Oops, something went wrong.