Giter Site home page Giter Site logo

planned-maintenance's Introduction

Planned Maintenance

Automate maintenance by defining actions in JavaScript and using the checklist runner.

This repository includes an action that will only succeed outside the maintenance window. For example, you might use this action to discourage people from pushing changes while maintenance is underway.

Inputs

maintenance-window-start

Required Time when the maintenance window will open. After this point, the checklist will be enabled and the action will fail

maintenance-window-duration

Required Number of milliseconds the maintenance window will remain open for

maintenance-window-enabled

Required Whether to check the maintenance window at all

maintenance-url

Optional URL with more information about this maintenance, will be displayed in error output

Outputs

message

Explains why your branch was rejected.

This message is also printed in the script's standard output.

Example usage

name: Planned maintenance

on: pull_request

jobs:
  check:
    runs-on: ubuntu-latest
    name: Is this branch allowed at this time?
    steps:
      - name: Is now a good time?
        id: check
        uses: andrew-sayers/[email protected]
        with:
          maintenance-window-start: "2021-01-01T06:00:00Z"
          maintenance-window-duration: 360000,
          maintenance-url: "https://github.com/my-user/my-repo/issues/12345"

Multi-repository usage

Maintenance often works across several repositories at once, so we would like to set the maintenance window in one location and have it apply to all associated repositories.

You could use encrypted secrets to achieve this, but that can be quite clunky. An alternative is to create a custom action that outputs your settings, then use that as input to the planned-maintenance action.

To create a custom action, fork the planned-maintenance-info repository or use it as a template. Put your information in index.js and push the changes. Then you can create a workflow like this:

name: Planned maintenance

on: pull_request

jobs:
  check:
    runs-on: ubuntu-latest
    name: Is this branch allowed at this time?
    steps:
      - name: Get maintenance window
        id: settings
        uses: your-username/your-planned-maintenance-info@main
      - name: Is now a good time?
        id: check
        uses: andrew-sayers/[email protected]
        with:
          maintenance-window-start: ${{ steps.settings.outputs.maintenance-window-start }}
          maintenance-window-duration: ${{ steps.settings.outputs.maintenance-window-duration }}
          maintenance-url: ${{ steps.settings.outputs.maintenance-url }}

planned-maintenance's People

Contributors

andrew-sayers avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.