Time for Action
Curiosity leads to action
Curiosity.., I was curious about GitHub actions, how they work and how can I build my own. That's right, it's always things you see and use, to leads invent or reinvent the wheel.
I created one and currently using the action in my profile https://github.com/jayantur13 to showcase my project releases. The name of the action is get-latest-releases in GitHub Marketplace.
The Making
During the making I followed the official documentation, some actions from Marketplace and other repos. Also, to get a start I vibed and found some great results.
My GitHub action is very simple. It works in following steps:
- Requires user/repo_name
- Make HTTP request to fetch releases of a user/repo_name, then detects if README.md has
<!--LATEST_RELEASES_START-->
<!--LATEST_RELEASES_END-->
- Auto-commit (if true) with all release data to README.md
- To avoid always committing there's a .json file that saves the info. > Necessary log for both success and failure case. > As actions are soon deprecating the use of node20 and asking to use node24, at first, I struggled to make the build work then used esbuild (or rollup was other option)
Here's the action
name: Fetch and upate with latest release
on:
schedule:
- cron: "0 0 * * *" # daily at midnight UTC
workflow_dispatch:
jobs:
update_releases:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Update latest releases
uses: jayantur13/get-latest-releases@v1
with:
repos: |
vercel/next.js
facebook/react
readme_path: "README.md"
max_repos: "3"
theme: list
include_body: "true"
exclude_prereleases: "false"
header_title: ""
footer_link_text: "Explore More →"
show_global_footer: "true"
date_format: "short"
skip_if_no_change: "true"
auto_commit: "true"
token: ${{ secrets.GITHUB_TOKEN }}
Under. GitHub/workflows/action_name.yml it will run daily UTC midnight
Here's the detail about parameters:
Name | Description | Default | Required |
---|---|---|---|
repos |
List of repositories (owner/repo ) separated by newlines |
– | ✅ |
readme_path |
Path to your README file | README.md |
❌ |
max_repos |
Maximum number of repositories to display | 5 |
❌ |
include_body |
Include release notes text | true |
❌ |
exclude_prereleases |
Skip prereleases | true |
❌ |
theme |
Markdown layout: table , list , card , compact
|
table |
❌ |
header_title |
Custom section title (value,"") | 🔖 Latest Releases |
❌ |
footer_link_text |
Text for global footer link | See All Releases → |
❌ |
show_global_footer |
Show or hide the footer link | true |
❌ |
date_format |
Date format (ISO , relative , none ) |
ISO |
❌ |
skip_if_no_change |
Skip update if no new release is found | true |
❌ |
auto_commit |
Automatically commit README changes | false |
❌ |
token |
GitHub token for API access | ${{ github.token }} |
❌ |
Theme Appearance
I found a useful action like listing blog post in readme, which had me curious and inspired me to try making this action.
I am not much of writer. But yeah, tried to write and if, you like this article react/comment in this post and give a try to get-latest-releases in GitHub Marketplace.
Thanks for reading.
Top comments (0)