IAmHughes / giphy-generator

A GitHub Action to generate a gif in a comment on issues and PRs, responding to the command `/giphy <search_term>`. Written in JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GIPHY Generator - GitHub Action.

A GitHub Action (written in JavaScript) to generate a comment on issues and PRs, responding to the command /giphy <search_term>, leveraging the GIPHY API. Powered by GIPHY and GitHub Actions!

For example, if you commented on an Issue and included the phrase /giphy another one, you would see a comment from this action of a gif response from GIPHY's Search API for another one:

/giphy another one

This repo isn't actively maintained, and may contain bugs. PRs welcome, though this was a fun PoC project.

Usage

Pre-requisites

Create a workflow .yml file in your .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

For more information on these inputs, see the GIPHY API Documentation.

  • rating: The content rating used to filter results from the GIF search. Default: g
  • lang: The default language that the search query is in. Default: en for English

Example workflow - giphy generator

When an issue or pull_request has a new comment that contains the /giphy <search_term> phrase (or is opened/edited), and add a comment powered by GIPHY to add a GIF using the given search phrase:

on:
  issues:
    types: [opened, edited]
  pull_request:
    types: [opened, edited]
  issue_comment:
    types: [created, edited]

name: GIPHY Generator

jobs:
  giphy-generator:
    name: GIPHY Generator
    runs-on: ubuntu-latest
    steps:
      - name: GIPHY Generator
        id: giphy_generator
        uses: iamhughes/giphy-generator@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
          GIPHY_TOKEN: ${{ secrets.GIPHY_TOKEN }} # This token should be created on giphy.com: https://developers.giphy.com/dashboard/?create=true
        with:
          rating: 'g'
          lang: 'en'

Contributing

I would love for you to contribute, pull requests are welcome! Please see the CONTRIBUTING.md for more information.

/giphy motivation

License

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

Disclaimer

This leverages the GIPHY API to query results based on inputs you provide and the rating you use. As a consumer of this action, you accept responsibility of any gifs that are posted by this bot. The owner of this action does not control the search algorithm or endpoint that is returning images and is not responsible for it's content.

/giphy challenge accepted

About

A GitHub Action to generate a gif in a comment on issues and PRs, responding to the command `/giphy <search_term>`. Written in JavaScript.

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%