{"id":15048458,"url":"https://github.com/coreybutler/github-autotag","last_synced_at":"2025-10-04T10:30:44.366Z","repository":{"id":57251255,"uuid":"46152061","full_name":"coreybutler/github-autotag","owner":"coreybutler","description":"Monitor package.json for version changes and auto-tag new releases.","archived":true,"fork":false,"pushed_at":"2017-11-26T18:33:15.000Z","size":11,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-14T01:52:17.887Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coreybutler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-13T23:09:23.000Z","updated_at":"2024-03-14T14:08:43.000Z","dependencies_parsed_at":"2022-08-24T17:01:21.956Z","dependency_job_id":null,"html_url":"https://github.com/coreybutler/github-autotag","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreybutler%2Fgithub-autotag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreybutler%2Fgithub-autotag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreybutler%2Fgithub-autotag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreybutler%2Fgithub-autotag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coreybutler","download_url":"https://codeload.github.com/coreybutler/github-autotag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235238018,"owners_count":18958033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T21:13:13.921Z","updated_at":"2025-10-04T10:30:44.003Z","avatar_url":"https://github.com/coreybutler.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Github Autotag Utility\n\nMonitor package.json for version changes and auto-tag new releases.\n\n`npm install github-autotag`\n\n## Overview\n\nThis module was designed to help automatically create new tags for npm modules (or anything using package.json).\nAt [Ecor Ventures](http://ecorventures.com), we use [Travis-CI](http://travis-ci.org) to unit test our open source\nmodules and deploy them. Travis can be configured to watch for new Github tags and automatically create a release\nfrom the new tag. Other services, such as [jsdelivr](http://github.com/jsdelivr/jsdelivr) will automatically update\nbased on releases. We also use webhooks to respond to new releases and publish npm updates.\n\nTo do this, we use this module as part of an [iron.io](http://iron.io) worker. Once the worker is uploaded to iron.io,\nwe point a Github webhook to the worker URL. When a new commit/merge is detected, the iron.io script is triggered.\n\n## Usage\n\n```js\nvar AutoTagger = require('github-autotag')\n\nAutoTagger.monitor({\n  repo: process.env.GITHUB_REPO,\n  user: process.env.GITHUB_USER,\n  pass: process.env.GITHUB_PASSWORD,\n  email: process.env.EMAIL, // This is required to create a new tag\n  before: 'original SHA', // See below\n  after: 'commit SHA', // See below\n  branch: process.env.GITHUB_REPO_BRANCH, // optional, defaults to master\n}, function (err, tag) {\n  if (err) {\n    console.error(err)\n  } else if (tag) {\n    console.log('New tag created:', tag)\n  } else {\n    console.log('No update necessary.')\n  }\n})\n```\n\n## SHA values?\n\nThe SHA values are typically delivered in the payload of a webhook. For example:\n\n```js\n{\n  \"ref\": \"refs/heads/master\",\n  \"before\": \"911eb1d755776f31bbf1bda4d798317ea6cdf907\",\n  \"after\": \"067ac29825b69a2abd9f5ce5ef2795434b700ea1\",\n  \"created\": false,\n  \"deleted\": false,\n  \"forced\": false,\n  \"base_ref\": null,\n  \"compare\": \"https://github.com/coreybutler/github-autotag/compare/911eb1d75577...067ac29825b6\",\n  \"commits\": [\n    {\n      \"id\": \"067ac29825b69a2abd9f5ce5ef2795434b700ea1\",\n      \"distinct\": true,\n      \"message\": \"Test code\",\n      \"timestamp\": \"2015-11-13T17:49:09-06:00\",\n      \"url\": \"https://github.com/coreybutler/github-autotag/commit/067ac29825b69a2abd9f5ce5ef2795434b700ea1\",\n      \"author\": {\n        \"name\": \"Corey Butler\"\n      }\n    }\n  ]\n}\n```\n\nThe `before` and `after` contain the values necessary to identify package.json version updates.\n\n# Create a Worker\n\nWe use the following code as an iron.io worker.\n\n```js\nvar worker = require('iron_worker')\nvar payload = worker.params()\nvar cfg = worker.config()\nvar AutoTagger = require('github-autotag')\n\nif (payload.ref.indexOf('refs/tags/') \u003e= 0) {\n  console.log('IGNORED:')\n  console.log('This commit is a tag. No need to tag it again.')\n  return\n}\n\nAutoTagger.monitor({\n  repo: payload.repository.full_name,\n  user: cfg.GITHUB_USER,\n  pass: cfg.GITHUB_PASSWORD,\n  email: cfg.EMAIL,\n  before: payload.before,\n  after: payload.after\n}, function (err, tag) {\n  if (err) {\n    console.error(err)\n  } else if (tag) {\n    console.log('New tag created:', tag)\n  } else {\n    console.log('No update necessary.')\n  }\n})\n```\n\nTo use this, acquire the iron.io webhook link and add it to your Github repo webhooks (Push only).\n\n### Example\n\nCheck out [NGN Chassis](http://github.com/ngnjs/chassis-lib) as an example of how we use this.\nNGN Chassis uses Travis-CI to run tests. It is also capable of monitoring Github tags that\nconform to semantic versioning. As a result, we are able to use github-autotag to run as a\npart of Travis CI process. When github-autotag creates the new version tag, the Travis CI \ndeployment process automatically creates a new Github release. This in turn is recognized by\nthe jsdelivr CDN, which updates the CDN.\n\nIt's kind of a game of dominoes, but it completely automates the CI/CD process for us.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreybutler%2Fgithub-autotag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoreybutler%2Fgithub-autotag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreybutler%2Fgithub-autotag/lists"}