Leveraging Githooks for efficient GitHub Actions optimization

Summary of my bookmarked links from Sep 22nd, 2022


  • Using Githooks to DRY out GitHub Actions

    The author describes their solution for reducing code repetition in GitHub Actions workflows by using pre-commit hooks. They explain the limitations of GitHub Actions regarding YAML anchors and the challenges they faced with maintaining multiple workflows with similar steps. To address this, they set up a pre-commit hook that parses YAML files containing common logic, removes anchors, and writes the parsed content to new files recognized by GitHub Actions. They share the reasons behind choosing this solution and provide details on how it was built using Python and git hooks. The solution ensures consistency and saves time by automatically applying changes to all related workflows.