Skip to content

GitHub Readme YouTube Cards

Workflow for displaying recent YouTube videos as SVG cards in your readme.

ref-reporef-official-docref-dependent-action

Usage

  1. Add the following snippet to your markdown file where you want the cards to appear.
yaml
<!-- BEGIN YOUTUBE-CARDS -->
<!-- END YOUTUBE-CARDS -->
  1. In your repo, create a .github folder and inside create a folder named workflows if it does not exist. Then create a file in your .github/workflows/ folder and give it a name such as youtube-cards.yml with the following contents.
yaml
name: GitHub Readme YouTube Cards
on:
  schedule:
    # Runs every hour, on the hour
    - cron: "0 * * * *"
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    # Allow the job to commit to the repository
    permissions:
      contents: write
    # Run the GitHub Readme YouTube Cards action
    steps:
      - uses: DenverCoder1/github-readme-youtube-cards@main
        with:
          # Your YouTube channel ID
          channel_id: UCipSxT7a3rn81vGLw9lqRkg

Parameters

DenverCoder1/github-readme-youtube-cards@main

Click to show/close parameters

NameTypeRequiredDefaultDescriptionMore Description
ref-actions
channel_idstringtrueYour YouTube channel ID
playlist_idstringPlaylist ID
langstringenLanguage
comment_tag_namestringYOUTUBE-CARDSThe text in the comment tag for replacing content
youtube_api_keystringYouTube API key
max_videosnumber6The maximum number of videos to display
base_urlstringhttps://ytcards.demolab.com/The base URL to use for the cards
card_widthnumber250The width of the SVG cardsUnit: pixels.
border_radiusnumber5The border radius of the SVG cards
background_colorstring#0d1117The background color of the SVG cards
title_colorstring#ffffffThe color of the title text
stats_colorstring#dededeThe color of the stats text
theme_context_lightany{}JSON object with light mode colors
theme_context_darkany{}JSON object with dark mode colors
max_title_linesnumber1The maximum number of lines to use for the title
show_durationbooleanfalseWhether to show the duration of the videosRequires the YouTube API key youtube_api_key.
author_namestringGitHub ActionsThe name of the commit author
author_emailstring41898282+github-actions[bot]@users.noreply.github.comThe email address of the commit author
commit_messagestringdocs(readme): Update YouTube cardsThe commit message to use for the commit
readme_pathstringREADME.mdThe path to the Markdown or HTML file to update
output_onlybooleanfalseWhether to skip writing to the readme file
output_typestringmarkdownThe output syntax to useAvailable options: markdown html.
ref-action-outputs
markdownstringtrueThe generated Markdown or HTML used for updating the README file
committedstringtrueWhether the action has created a commitPossible: true false.
commit_long_shastringtrueThe full SHA of the commit that has just been created
commit_shastringtrueThe short 7-character SHA of the commit that has just been created
pushedstringtrueWhether the action has pushed to the remotePossible: true false.

Examples

yaml
# Example usage: https://github.com/DenverCoder1/github-readme-youtube-cards/blob/main/.github/workflows/youtube-cards.yml
name: GitHub Readme YouTube Cards
on:
  schedule:
    # Runs every day at 12:00
    - cron: "0 12 * * *"
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: DenverCoder1/github-readme-youtube-cards@main
        id: youtube-cards
        with:
          channel_id: UCipSxT7a3rn81vGLw9lqRkg
          comment_tag_name: EXAMPLE-YOUTUBE-CARDS
          youtube_api_key: ${{ secrets.YOUTUBE_API_KEY }}
          show_duration: true
          theme_context_light: '{ "background_color": "#ffffff", "title_color": "#24292f", "stats_color": "#57606a" }'
          theme_context_dark: '{ "background_color": "#0d1117", "title_color": "#ffffff", "stats_color": "#dedede" }'
          max_title_lines: 2
          output_type: html
      - run: echo OUTPUT '${{ steps.youtube-cards.outputs.markdown }}'
        shell: bash
GitHub Star Swag Unboxing and GiveawaysHow To Self-Host GitHub Readme Streak Stats on VercelAutomatically Deploy to Fly.io with GitHub ActionsHosting a Python Discord Bot for Free with Fly.ioMaking a Wordle Clone Discord Bot with Python (Nextcord)Run Open Source Code in Seconds with GitPod

Readme Widget Hub (v4.1.4) MIT Licensed