Skip to content

feat: Add markdown as action output #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/youtube-cards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ jobs:
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" }'
- run: echo OUTPUT '${{ steps.youtube-cards.outputs.markdown }}'
shell: bash
44 changes: 27 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,40 @@ See [action.yml](https://github.com/DenverCoder1/github-readme-youtube-cards/blo

Check out the [Wiki](https://github.com/DenverCoder1/github-readme-youtube-cards/wiki) for frequently asked questions.

| Option | Description | Default |
| ------------------------ | ------------------------------------------------------- | ------------------------------------------------------- |
| `channel_id` | The channel ID to use for the feed | Required |
| `comment_tag_name` | The name in the comment tag for replacing content | "YOUTUBE-CARDS" |
| `youtube_api_key` | The API key to use for additional features marked below | "" |
| `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 colors for light mode\* | "{}" |
| `theme_context_dark` | JSON object with colors for dark mode\* | "{}" |
| `show_duration` ![][key] | 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" |
### Inputs

| Option | Description | Default |
| ------------------------ | ------------------------------------------------- | ------------------------------------------------------- |
| `channel_id` | The channel ID to use for the feed | Required |
| `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 below | "" |
| `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 colors for light mode\* | "{}" |
| `theme_context_dark` | JSON object with colors for dark mode\* | "{}" |
| `show_duration` ![][key] | 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" |

![key][key] YouTube API Key required. See [Setting Up the Action with a YouTube API Key](https://github.com/DenverCoder1/github-readme-youtube-cards/wiki/Setting-Up-the-Action-with-a-YouTube-API-Key) in the wiki for more information.

\* See [Setting Theme Contexts for Light and Dark Mode](https://github.com/DenverCoder1/github-readme-youtube-cards/wiki/Setting-Theme-Contexts-for-Light-and-Dark-Mode) in the wiki for more information.

[key]: https://user-images.githubusercontent.com/20955511/189419733-84384135-c5c4-4a20-a439-f832d5ad5f5d.png

### Outputs

| Output | Description |
| ---------- | ---------------------------------------------------------------- |
| `markdown` | The generated markdown section used for updating the README file |

## Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request if you have a way to improve this project.
Expand Down
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ inputs:
description: "The path to the readme file"
required: false
default: "README.md"
output_only:
description: "Whether to return the section markdown as output instead of writing to the file"
required: false
default: "false"

outputs:
markdown:
description: "The section markdown as output"
value: ${{ steps.generate-readme-update.outputs.markdown }}

runs:
using: "composite"
Expand Down Expand Up @@ -104,6 +113,7 @@ runs:
--theme-context-dark '${{ inputs.theme_context_dark }}' \
--readme-path "${{ inputs.readme_path }}" \
) || exit 1
echo "::set-output name=markdown::$(echo $UPDATE)"

- name: Commit changes
uses: EndBug/add-and-commit@v9
Expand Down