Git Product home page Git Product logo

countapi-action's Introduction

CountAPI Action

Use CountAPI in your GitHub actions. Useful for persisting counts between action runs and across workflows. Not affiliated with CountAPI.

Examples

Hit

Increment a key by one. If the key does not exist, a new key will be created at set to 1.

- name: Increment build number
    id: build_number
    uses: owenandrews/[email protected]
    with:
        namespace: example.com #required
        key: build-number #required

and then access the result in a following step with ${{ steps.build_number.outputs.result.value }}.

Example result:

{
    status: 200,
    path: "example.com/build-number",
    value: 27
}

Create

Create a new key with a number of optional parameters.

ℹ️ If you'd just like to increment a number you can use the hit method, it will create a new key if one does not already exist.

- name: Example create counter
  uses: owenandrews/[email protected]
  with:
    method: create
    namespace: example.com #required
    key: build-number #required
    value: 10 #optional
    enable_reset: true #optional
    update_lowerbound: 2 #optional
    update_upperbound: 4 #optional

Example result:

{
  status: 200,
  path: "example.com/build-number",
  namespace: "example.com",
  key: "build-number",
  value: 10
}

Update

Increment or decrement an existing key by a certain amount.

- name: Example update counter
  uses: owenandrews/[email protected]
  with:
    method: update
    namespace: example.com #required
    key: build-number #required
    amount: 10 #optional

ℹ️ amount must be within update_lowerbound and update_upperbound specified during the creation of the key.

Example result:

{
  status: 200,
  path: "mysite.com/test",
  value: 42
}

⚠️ If the amount provided is invalid you will get status 403, but the step will still succeed.

Set

Set a key to an arbitary value.

- name: Example set counter
  uses: owenandrews/[email protected]
  with:
    method: set
    namespace: example.com #required
    key: build-number #required
    value: 5 #optional

ℹ️ To set a key, it must be created with enable_reset set to true.

Example result:

{
  status: 200,
  path: "example.com/build-number",
  old_value: 136,
  value: 5
}

⚠️ If the key has enable_reset set to false, status will be 403 and the old_value will match value (the key stays the same). The step will still succeed.

Get

- name: Example get counter
  uses: owenandrews/[email protected]
  with:
    method: get
    namespace: example.com #required
    key: build-number #required

Example result:

{
  status: 200,
  path: "example.com/build-number",
  value: 136
}

Info

Retrive information about a key.

- name: Example get counter info
  uses: owenandrews/[email protected]
  with:
    method: info
    namespace: example.com #required
    key: build-number #required

Example result:

{
  status: 200,
  path: "example.com/build-number",
  namespace: "example.com",
  key: "build-number",
  ttl: 15769998014,
  created: 1553794487479,
  update_lowerbound: 0,
  update_upperbound: 1,
  enable_reset: false,
  value: 79
}

Stats

Get some CountAPI stats.

- name: Example get global CounterAPI stats
  uses: owenandrews/[email protected]
  with:
    method: stats
    namespace: example.com #required, but not used
    key: build-number #required, but not used

Example result:

{
  keys_created: 111111,
  keys_updated: 111111,
  requests: 111111,
  version: "xxxxxx"
}

countapi-action's People

Contributors

owenandrews avatar

Stargazers

Roman avatar

Watchers

 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.