<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged githubworkflow</title>
<link>https://coderlegion.com/tag/githubworkflow</link>
<description>Powered by Question2Answer</description>
<item>
<title>Dynamic GitHub Actions Dropdowns — A Clever Workaround Made Reusable!</title>
<link>https://coderlegion.com/31452/dynamic-github-actions-dropdowns-a-clever-workaround-made-reusable</link>
<description>&lt;p&gt;GitHub Actions doesn't natively support dynamically populated dropdown options for &lt;code&gt;workflow_dispatch&lt;/code&gt; inputs. This can become a maintenance headache, especially when managing multiple packages in an npm monorepo.&lt;/p&gt;
&lt;p&gt;I came across a clever workaround shared by &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/jeevan-vj&quot;&gt;@jeevan-vj&lt;/a&gt;, demonstrating how to dynamically maintain dropdown options by automatically updating GitHub Actions workflow YAML files.&lt;/p&gt;
&lt;p&gt;Inspired by that approach, I built a &lt;strong&gt;reusable GitHub Actions workflow&lt;/strong&gt; that uses a dedicated &lt;code&gt;WORKFLOW_TOKEN&lt;/code&gt; to update workflow files and automatically discover publishable packages in an npm monorepo.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Here's what my implementation adds:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;✅ &lt;strong&gt;Automatic package discovery&lt;/strong&gt; — Detects publishable npm workspace packages without maintaining a hardcoded list.&lt;/p&gt;
&lt;p&gt;✅ &lt;strong&gt;Multi-workflow synchronization&lt;/strong&gt; — Keeps package dropdown options consistent across multiple GitHub Actions workflows.&lt;/p&gt;
&lt;p&gt;✅ &lt;strong&gt;YAML formatting preservation&lt;/strong&gt; — Uses Python and &lt;code&gt;ruamel.yaml&lt;/code&gt; to update workflow configurations while preserving their structure and formatting.&lt;/p&gt;
&lt;p&gt;✅ &lt;strong&gt;Automatic and manual execution&lt;/strong&gt; — Supports synchronization on push as well as manual triggering when needed.&lt;/p&gt;
&lt;p&gt;✅ &lt;strong&gt;Configurable token authentication&lt;/strong&gt; — Accepts a &lt;code&gt;workflow-token&lt;/code&gt; secret, allowing each consuming repository to choose its own secret name.&lt;/p&gt;
&lt;p&gt;✅ &lt;strong&gt;No unnecessary commits&lt;/strong&gt; — Updates workflow files only when package options actually change.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;The end result?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;My &lt;strong&gt;release, publish, restore, reset, and release-draft workflows&lt;/strong&gt; now automatically stay synchronized with the publishable packages in my npm monorepo.&lt;/p&gt;
&lt;p&gt;No more manually updating package dropdowns every time a package is added, renamed, or removed.&lt;/p&gt;
&lt;p&gt;Even better, the solution is reusable across repositories, so I have adopted the same automation in other repos without duplicating the synchronization logic.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Original inspiration — @jeevan-vj:&lt;/strong&gt;&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/jeevan-vj/iamjeevan/blob/master/data/blog/dynamically-populating-parameter-options-in-manual-github-action.md&quot;&gt;https://github.com/jeevan-vj/iamjeevan/blob/master/data/blog/dynamically-populating-parameter-options-in-manual-github-action.md&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;My reusable workflow implementation:&lt;/strong&gt;&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/moyarich/reusable-workflows/blob/main/.github/workflows/reusable_sync-release-package-choices.yml&quot;&gt;https://github.com/moyarich/reusable-workflows/blob/main/.github/workflows/reusable_sync-release-package-choices.yml&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Real-world implementation — Workspace Tools:&lt;/strong&gt;&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/moyarich/workspace-tools/blob/main/.github/workflows/sync-release-package-choices.yml&quot;&gt;https://github.com/moyarich/workspace-tools/blob/main/.github/workflows/sync-release-package-choices.yml&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Huge credit to @jeevan-vj&lt;/strong&gt; 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.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;How are you managing dynamic inputs in your GitHub Actions workflows?&lt;/strong&gt; Have you found another approach?&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/31452/dynamic-github-actions-dropdowns-a-clever-workaround-made-reusable</guid>
<pubDate>Fri, 16 Oct 2026 19:57:00 +0000</pubDate>
</item>
</channel>
</rss>