Some time ago, I wrote an article about preventing deploys on Friday as part of CI/CD. I provided an example for GitLab CI/CD. GitHub Actions became popular, and I decided to publish an open-source action you can integrate into your workflows.
Usage
Go to your workflow YAML file, and add the following few lines to your job steps:
- uses: HormCodes/do-not-deploy-on-friday@v1
with:
timezone: Europe/Oslo
The action will fail in case the workflow execution is on Friday. Check the README for more details about possible inputs and outputs.
Lessons Learned
It was my first GitHub Action. I experimented with configuring an automated (but also optimized) semantic release workflow. There are a few learnings for custom actions in JavaScript:
- Use @vercel/ncc to compile your sources (and used
node_modules
) into a single file. It also has built-in TypeScript support. - Official documentation for GitHub Actions recommends including a build directory in the
main
branch. Create an independent commission with a tag that contains just the build. - GitHub action should follow semantic versioning, but users should use the major version tag
v1
etc. - It is not easy to create CI/CD for publishing actions to the marketplace. I ended up combining semantic-release and JasonEtco/build-and-tag-action. You can check my pipeline here.
The repository is open source, and external contributions are welcome. Please share with me your feedback or projects that are using this action.