Giter Club home page Giter Club logo

unfurl-links's Introduction

Unfurl Links

Unfurl links on Issues and Pull Request discussions.

screenshot

Usage

Create .github/workflows/unfurl-links.yml in the default branch:

name: Unfurl Links
on:
  issues:
    types: [opened, edited]
  issue_comment:
    types: [created, edited]
  pull_request:
    types: [opened, edited]
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: wow-actions/unfurl-links@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Inputs

GITHUB_TOKEN

Your GitHub token for authentication.

raw

Specify if only render the raw links. Default true.

raw links

Set raw to false to render all links.

name: Unfurl Links
on:
  issues:
    types: [opened, edited]
  issue_comment:
    types: [created, edited]
  pull_request:
    types: [opened, edited]
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: wow-actions/unfurl-links@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          raw: false

all links

header

Cutsom header of the unfurled card. header can be a Handlebars template and rendered with parsed metadata.

name: Unfurl Links
on:
  issues:
    types: [opened, edited]
  issue_comment:
    types: [created, edited]
  pull_request:
    types: [opened, edited]
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: wow-actions/unfurl-links@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          header: '<i><a href="{{ url }}">{{ url }}</a></i>'

custom header

template

Handlebars template to render the unfurled card. The template will be rendered with parsed metadata from url.

interface Metadata {
  url: string
  header?: string
  title?: string
  titleLink?: string
  authorName?: string
  authorIcon?: string
  authorLink?: string
  thumb?: string
  content?: string
  image?: string
  footer?: string
  footerLink?: string
  footerIcon?: string
}

And the default template is:

<blockquote>
  {{#if header}}
    {{{header}}}
  {{/if}}

  {{#if thumb}}
    <img src='{{thumb}}' width='48' align='right' />
  {{/if}}

  {{#if authorName}}
    <div>
      {{#if authorIcon}}
        <img src='{{authorIcon}}' height='14' />
      {{/if}}
      {{#if authorLink}}
        <a href='{{authorLink}}'>{{authorName}}</a>
      {{else}}
        {{authorName}}
      {{/if}}
    </div>
  {{/if}}

  {{#if title}}
    <div>
      <strong>
        {{#if titleLink}}
          <a href='{{titleLink}}'>{{title}}</a>
        {{else}}
          {{title}}
        {{/if}}
      </strong>
    </div>
  {{/if}}

  {{#if content}}
    <div>{{content}}</div>
  {{/if}}

  {{#if image}}
    <br />
    <img src='{{image}}' />
  {{/if}}

  {{#if footer}}
    <h6>
      {{#if footerIcon}}
        <img src='{{footerIcon}}' height='14' />
      {{/if}}
      {{#if footerLink}}
        <a href='{{footerLink}}'>{{footer}}</a>
      {{else}}
        {{footer}}
      {{/if}}
    </h6>
  {{/if}}

</blockquote>

License

The scripts and documentation in this project are released under the MIT License

unfurl-links's People

Contributors

bubkoo avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

vsamaru

unfurl-links's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.