npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

github-deploy-status

v1.4.1

Published

Node.js scripts that update a Github repository's deployment status.

Downloads

32

Readme

Github deploy status

Node.js scripts that update a Github repository's deployment status.

Did you know that you keep track of your deployments right on Github.com? You can do this through the Environment tab!

environments

What is the Environment tab and why don't I see it on my repositories?

The Environment tab only shows up if you add a deployment to your Github repository. Once you've added a deployment, you can update its status to show whether it's pending, in progress, successful, failed, or errored. Some third-party integrations such Heroku do this for you, so when you deploy through that service, it shows up on your Github page. If you deploy through custom CI scripts using services such as Travis CI, this won't show up automatically.

This package provides CLI scripts to help interface with Github's deployments API so you can track your deployments right in your pull requests:

pullrequest

And see a history of your deployments in the Environment tab!

activitylog

Usage

Install this package using yarn or npm:

yarn add -D github-deploy-status
npm i -D github-deploy-status

You can now use the command right in your shell!

github-deploy-status ...

Just make sure you give the correct arguments. See below for the arguments required.

Arguments

--token <token>

This argument is required.

Interfacing with the Github API requires authentication. Create a personal API token and provide it to the script so that it can use it to authorise your requests. Ensure that you grant your token the repo_deployment scope.

--action <action> or -a <action>

This argument is required.

<action> must be one of the following values:

  • create
  • fail_if_unsuccessful
  • success
  • failure
  • error

Using create action will create a new deployment.

The fail_if_unsuccessful action is special - it will first check the status of the latest deployment. If it is NOT successful (e.g. it is pending or in progress), it will add a new failure status. This is useful to call at the end of your deployment scripts in case the deployment doesn't complete and there is no way to receive feedback other than to check the deployment status.

There must be an existing deployment before you add deployment statuses. The remaining actions (success, failure, error) will add the respective statuses to the most recent deployment.

--environment <environment> or -e <environment

This argument is required.

Use this to provide the name of the environment you are deploying to. Common values for this are dev, staging or production.

--ref <ref> or -r <ref>

This argument is required.

Provide the ref of what you want to deploy from your repository. This can be a tag, branch, or SHA.

--user <username> or -u <username>

This argument is required.

Provide the username of the user who owns the repository that you are managing deployments for.

--repo <repo_name> or -p <repo_name>

This argument is required.

Provide the name of the repository that you are managing deployments for.

--url <url> or -l <url>

This argument is optional.

Provide a link to the deployed environment if you want the View deployment button to show up next to your active deployments.

Example

One way to take advantage of this script is to add it to your package.json and .travis.yml:

package.json:

{
  ...
  "scripts": {
    "install-all": "yarn",
    "build-all": "tsc",
    "gds": "github-deploy-status -u a-user -p some-repository"
  }
  ...
}

.travis.yml:

...

jobs:
  include:
    - stage: Staging
      before_deploy:
        - yarn add github-deploy-status
        - yarn gds --token $GITHUB_TOKEN -a create -e staging -r develop
        - yarn gds --token $GITHUB_TOKEN -a in_progress -e staging -r develop
      deploy:
        ...
        on:
          branch: develop
      after_deploy:
        - yarn gds --token $GITHUB_TOKEN -a success -e staging -r develop -l https://staging.myapp.com

    - stage: Production
      before_deploy:
        - yarn add github-deploy-status
        - yarn gds --token $GITHUB_TOKEN -a create -e production -r master
        - yarn gds --token $GITHUB_TOKEN -a in_progress -e production -r master
      deploy:
        ...
        on:
          branch: master
      after_deploy:
        - yarn gds --token $GITHUB_TOKEN -a success -e production -r master -l https://myapp.com
...

In the above example, a deployment is created when Travis starts a deployment (whose status is set to pending by default), and the status is set to success once the deployment completes. The user's Github access token is stored as an environment variable on Travis CI and is access through $GITHUB_TOKEN.

License

MIT License