emmanuelnk / github-actions-workflow-ts

Write Github Actions workflow files in TypeScript (compiles to YAML)
MIT License
104 stars 3 forks source link

[Feature Request]: Validate if the generated actions is out of date #24

Open tusharmath opened 4 days ago

tusharmath commented 4 days ago

Expected Behavior

The generated workflow should automatically detect if it has been modified and fail CI if it happens.

Actual Behavior

CI should fail if the generated workflow is out of sync.

Additional Information This is a fantastic tool @emmanuelnk! I have been looking for something like this ever since I moved from https://github.com/sbt/sbt-github-actions

One very useful feature I miss from SBT Github Actions is the githubWorkflowCheck setting. When enabled it would automatically check if the generated workflow is out of date and fail the CI if it did.

Let me know your thoughts of supporting this feature. Thanks once again for building this amazing tool!

emmanuelnk commented 4 days ago

This is actually something I've also been wanting to implement for a while now. Basically, this would be a diff between a workflow file that current exists and one that will be generated.

Thinking to make use of a package like diff to generate a diff output with a command like npx gwf diff. I'll add a config option to throw an error on diff but I won't enforce it since this may not be desired behavior for other devs.

I'll probably get something working over the weekend.

tusharmath commented 3 days ago

I think instead of diff, we just need to perform an equality "check". A simple textual comparison should be enough. I would try to avoid adding a dependency unless really needed.