Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

probot-metadata

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

probot-metadata

A Probot extension to store metadata on Issues and Pull Requests

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-38.46%
Maintainers
5
Weekly downloads
 
Created
Source

Probot: metadata

A Probot extension to store metadata on Issues and Pull Requests.

Usage

const metadata = require('probot-metadata');

// where `context` is a Probot `Context`
await metadata(context).set(key, value)

const value = await metadata(context).get(key)

Example

const metadata = require('probot-metadata');

module.exports = robot => {
  robot.on('issue_comment.created', async context => {
    match = context.payload.comment.body.match('/snooze (.*)')
    if(match) {
      metadata(context).set('snooze', match[1])
    }
  })
}

How it works

This extension is what you might call "a hack". GitHub doesn't have an API for storing metadata on Issues and Pull Requests, but it does have rather large comment fields. GitHub renders the comments as Markdown and will strip any unsupported HTML (including HTML comments like <!-- I can put whatever I want here -->), but still serves up the raw comment body through the API. This extension takes advantage of this "feature" to store JSON values on Issues and Pull Requests as HTML comments.

It will update the body of the original post and append an HTML comment with JSON values for each key. For example:

This is the body of the original post

<!-- probot = {"json": "here"} -->

Keywords

FAQs

Package last updated on 18 May 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc