Workflow for displaying recent YouTube videos as SVG cards in your readme
- Add the following snippet to your markdown file where you want the cards to appear.
<!-- BEGIN YOUTUBE-CARDS -->
<!-- END YOUTUBE-CARDS -->
- In your repo, create a
.github
folder and inside create a folder namedworkflows
if it does not exist. Then create a file in your.github/workflows/
folder and give it a name such asyoutube-cards.yml
with the following contents.
name: GitHub Readme YouTube Cards
on:
schedule:
# Runs every hour, on the hour
- cron: "0 * * * *"
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: DenverCoder1/github-readme-youtube-cards@main
with:
channel_id: UCipSxT7a3rn81vGLw9lqRkg
-
Make sure to change the
channel_id
to your YouTube channel ID. -
The cron expression in the example above is set to run at the top of every hour. The first time, you may want to trigger the workflow manually.
-
You're done! Star the repo and share it with friends! ⭐
See below for advanced configuration.
See action.yml for full details.
Check out the Wiki for frequently asked questions.
Option | Description | Default |
---|---|---|
channel_id |
The channel ID to use for the feed | Required |
lang |
The language for cards description text | "en" |
comment_tag_name |
The name in the comment tag for replacing content | "YOUTUBE-CARDS" |
youtube_api_key |
The API key to use for features marked with 🔑 | "" |
max_videos |
The maximum number of videos to display | 6 |
base_url |
The base URL to use for the cards | "https://ytcards.demolab.com/" |
card_width |
The width of the SVG cards | 250 |
background_color |
The background color of the SVG cards | "#0d1117" |
title_color |
The color of the title text | "#ffffff" |
stats_color |
The color of the stats text | "#dedede" |
theme_context_light |
JSON object with light mode colors 🎨 | "{}" |
theme_context_dark |
JSON object with dark mode colors 🎨 | "{}" |
show_duration 🔑 |
Whether to show the duration of the videos | "false" |
author_name |
The name of the commit author | "GitHub Actions" |
author_email |
The email address of the commit author | "41898282+github-actions[bot]@users.noreply.github.com" |
commit_message |
The commit message to use for the commit | "docs(readme): Update YouTube cards" |
readme_path |
The path to the README file | "README.md" |
output_only |
Whether to skip writing to the readme file | "false" |
🔑 YouTube API Key required. See Setting Up the Action with a YouTube API Key in the wiki for more information.
🎨 See Setting Theme Contexts for Light and Dark Mode in the wiki for more information.
Output | Description |
---|---|
markdown |
The generated markdown section used for updating the README file |
See Using the Markdown as an Action Output for more information.
Contributions are welcome! Feel free to open an issue or submit a pull request if you have a way to improve this project.
Make sure your request is meaningful and you have tested the app locally before submitting a pull request.
Please check out our contributing guidelines for more information on how to contribute to this project.
💙 If you like this project, give it a ⭐ and share it with friends!