Dynamic GitHub Actions Dropdowns — A Clever Workaround Made Reusable!

●1 ●4
calendar_today • schedule1 min read
— Originally published at dev.to

GitHub Actions doesn't natively support dynamically populated dropdown options for workflow_dispatch inputs. This can become a maintenance headache, especially when managing multiple packages in an npm monorepo.

I came across a clever workaround shared by @jeevan-vj, demonstrating how to dynamically maintain dropdown options by automatically updating GitHub Actions workflow YAML files.

Inspired by that approach, I built a reusable GitHub Actions workflow that uses a dedicated WORKFLOW_TOKEN to update workflow files and automatically discover publishable packages in an npm monorepo.

Here's what my implementation adds:

✅ Automatic package discovery — Detects publishable npm workspace packages without maintaining a hardcoded list.

✅ Multi-workflow synchronization — Keeps package dropdown options consistent across multiple GitHub Actions workflows.

✅ YAML formatting preservation — Uses Python and ruamel.yaml to update workflow configurations while preserving their structure and formatting.

✅ Automatic and manual execution — Supports synchronization on push as well as manual triggering when needed.

✅ Configurable token authentication — Accepts a workflow-token secret, allowing each consuming repository to choose its own secret name.

✅ No unnecessary commits — Updates workflow files only when package options actually change.

The end result?

My release, publish, restore, reset, and release-draft workflows now automatically stay synchronized with the publishable packages in my npm monorepo.

No more manually updating package dropdowns every time a package is added, renamed, or removed.

Even better, the solution is reusable across repositories, so I have adopted the same automation in other repos without duplicating the synchronization logic.

Original inspiration — @jeevan-vj:
https://github.com/jeevan-vj/iamjeevan/blob/master/data/blog/dynamically-populating-parameter-options-in-manual-github-action.md

My reusable workflow implementation:
https://github.com/moyarich/reusable-workflows/blob/main/.github/workflows/reusable_sync-release-package-choices.yml

Real-world implementation — Workspace Tools:
https://github.com/moyarich/workspace-tools/blob/main/.github/workflows/sync-release-package-choices.yml

Huge credit to @jeevan-vj for sharing the original workaround. It's a great example of how an open-source idea can evolve into a reusable solution that benefits other developers.

How are you managing dynamic inputs in your GitHub Actions workflows? Have you found another approach?

Want more #devops & #cicd deep dives?

Join 6,113+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

1 Comment

0 votes

More Posts

10x the Pull Requests, Not 10x the CI Bill: CircleCI's Rob Zuber on Testing for Coding Agents

Tom Smithverified - Nov 23

Demystifying the Ghost Failure in Firebase Hosting GitHub Actions

Next Big Creative - Jul 2

Static vs Dynamic Websites for SEO

floxolab - Sep 8

The Validation Bottleneck: Why Testing Is the New Speed Limit

Tom Smithverified - Apr 13

Deploying a Simple App on K3S in AWS EC2 with GitHub Actions & ECR

mahinshanazeer - Mar 24
chevron_left
131 Points • 5 Badges
1Posts
0Comments
I am an experienced software engineer, technology community builder, and open-source advocate

Related Jobs

View all jobs →

Commenters (This Week)

9 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!