Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 2.14 KB

README.md

File metadata and controls

64 lines (48 loc) · 2.14 KB

Weekend and Office Hour saver for Github Actions

GitHub Super-Linter CI Check dist/ CodeQL Coverage

This is a app that you can add to your github actions job to block auto deployment during the weekends and outside office hours

You should still be able to allow deployment via workflow_dispatch or workflow_call

Initial Setup

Add the following step in your github actions:

outputs:
  reason: ${{ steps.should-deploy.outputs.reason }}
  should_deploy: ${{ steps.should-deploy.outputs.shouldDeploy }}
steps:
  - use: assweet/gha-ts-no-deploy-time
    id: should-deploy
    with:
      no_deployment_days: Friday,Saturday,Sunday
      tz: "+8"
      country: SG
      state: SG
      region: SG
      office_hours_start: 9
      office_hours_end: 22

We obtain the list of holidays using the npm package date-holidays

You will need to check the arrangement for the state and region specified in the holidays package by running:

const h = new Holidays()
h.getCountries()

h.getStates('US')

h.getRegions('US', 'ca')

Testing and Debugging

npm install

INPUT_NO_DEPLOYMENT_DAYS=Friday,Saturday,Sunday INPUT_TZ=Asia/Singapore INPUT_COUNTRY=SG INPUT_STATE=SG INPUT_REGION=SG  INPUT_OFFICE_HOURS_START=9 INPUT_OFFICE_HOURS_END=22 npx ts-node src/index.ts

Performing release

  1. Commit changes
  2. git push -u origin releases/v1
  3. gh pr create --title "[No Deploy] Release me" --label abnormal
  4. Approve the PR, and merge the PR into the main branch