yutailang0119 / action-mackerel-api

GitHub Action for Mackerel API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

action-mackerel-api status

GitHub Action for Mackerel API

This action provides an interface for calling the Mackerel API endpoint and getting the resulting JSON response.

Features

Supports HTTP methods available in Mackerel API.

  • GET
  • POST
    • string format input
    • JSON format input
  • PUT
    • string format input
    • JSON format input
  • DELETE

Example

Usage

An example workflow(.github/workflows/post-mackerel.yml) to executing action follows:

name: Post Mackerel

on:
  push:

jobs:
  post-mackerel:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/github-script@v6
        id: create-body
        with:
          result-encoding: string
          script: |
            const time = Date.now() / 1000
            const body = [
              {
                name: 'Sample.foo',
                time: time,
                value: 30
              },
              {
                name: 'Sample.bar',
                time: time,
                value: 100
              }
            ]
            return JSON.stringify(body)
      - name: Post Mackerel
        uses: yutailang0119/action-mackerel-api@v3
        with:
          api-key: ${{ secrets.MACKEREL_API_KEY }}
          http-method: POST
          path: services/${{ secrets.MACKEREL_SERVICE_NAME }}/tsdb
          body: ${{ steps.create-body.outputs.result }}

Author

Yutaro Muta

References

License

action-mackerel-api is available under the MIT license. See the LICENSE file for more info.

About

GitHub Action for Mackerel API

License:MIT License


Languages

Language:TypeScript 97.2%Language:JavaScript 2.8%