Skip to content

💮 Unfurl links on Issues and Pull Request discussions

License

Notifications You must be signed in to change notification settings

wow-actions/unfurl-links

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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