Code Monkey home page Code Monkey logo

github-watcher-action's Introduction

GitHub Watcher Action

CI GitHub Marketplace

GitHub Watcher Action is a GitHub action for setting up custom reactions on various triggers using GitHub Watcher.

Cache is used for storing the state.

Usage

Add a workflow

name: Github Watcher

concurrency:
  group: ${{ github.workflow }} # allows only one run at a time

on:
  schedule:
    - cron: "*/5 * * * *" # every 5 minutes
  workflow_dispatch: # allows manual trigger

jobs:
  run-github-watcher:
    runs-on: ubuntu-20.04

    permissions:
      contents: read

    steps:
      - name: Checkout config file
        uses: actions/checkout@v4
        with:
          sparse-checkout: |
            .github/github-watcher-config.yaml
          sparse-checkout-cone-mode: false

      - name: Run
        uses: ovsds/github-watcher-action@v1
        with:
          config_path: .github/github-watcher-config.yaml
          env_variables: |
            GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
            TELEGRAM_TOKEN=${{ secrets.TELEGRAM_TOKEN }}
            TELEGRAM_CHAT_ID=${{ secrets.TELEGRAM_CHAT_ID }}

Add a config file

tasks:
  - id: example_task
    triggers:
      - id: example_trigger
        type: github
        token_secret:
          type: env
          key: GITHUB_TOKEN
        owner: ovsds
        subtriggers:
          - type: repository_issue_created
          - type: repository_pr_created
          - type: repository_failed_workflow_run
    actions:
      - id: example_action
        type: telegram_webhook
        chat_id_secret:
          type: env
          key: TELEGRAM_CHAT_ID
        token_secret:
          type: env
          key: TELEGRAM_TOKEN

More information on config can be found in GitHub Watcher Config

Action Inputs

Name Description Default
version Github Watcher version 0.3.1
config_path Path to the config file
env_variables Environment variables
state_path Path to state directory, should be absolute and independent from the runner's workspace, otherwise cache will not work correctly /tmp/github-watcher-action/state
env_path Path to env file, that will be used to pass env_variables to the container .env
state_cache_prefix Cache prefix for state directory github-watcher-state

Action Outputs

Name Description
state_cache_key Cache key for state directory

GitHub Watcher Settings

Settings file can be found in settings.yaml. Basically, it contains:

  • config_backend - yaml_file
  • state_backend - local_dir which is stored in GitHub cache.
  • queue_backend - in_memory

Development

Global dependencies

  • nvm
  • node

Taskfile commands

For all commands see Taskfile or task --list-all.

License

MIT

github-watcher-action's People

Contributors

ovsds avatar

Watchers

 avatar

github-watcher-action's Issues

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.