https://github.com/jackdbd/ackee-action
GitHub action to generate an Ackee analytics report
https://github.com/jackdbd/ackee-action
Last synced: 8 months ago
JSON representation
GitHub action to generate an Ackee analytics report
- Host: GitHub
- URL: https://github.com/jackdbd/ackee-action
- Owner: jackdbd
- License: mit
- Created: 2021-05-18T20:22:17.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-31T15:00:33.000Z (about 5 years ago)
- Last Synced: 2025-01-17T21:29:28.152Z (over 1 year ago)
- Language: TypeScript
- Size: 351 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Ackee Analytics Action 📊 📈
[](https://github.com/semantic-release/semantic-release) [](https://www.conventionalcommits.org/en/v1.0.0/)  [](https://coveralls.io/github/jackdbd/ackee-action?branch=main) [](https://www.codefactor.io/repository/github/jackdbd/ackee-action)
GitHub action to generate an Ackee analytics report.
## Inputs
### `endpoint`
**Required** — The URL for the /api endpoint of your Ackee GraphQL API server. Example: `https://demo.ackee.electerious.com/api`
### `username`
**Required** — The username that you use to authenticate with your GraphQL API server.
### `password`
**Required** — The password that you use to authenticate with your GraphQL API server.
### `domain_id`
**Required** — The ID of the domain you are monitoring with Ackee.
### `num_top_pages`
Optional — The top-performing N pages of the domain. Defaults to `10`.
### `query`
Optional — A custom GraphQL query. Maybe use the [Ackee demo](https://demo.ackee.electerious.com/api) to come up with your custom GraphQL query.
For example:
```graphql
query getTop10BrowsersOfLast6Months {
domains {
statistics {
browsers(sorting: TOP, type: WITH_VERSION, range: LAST_6_MONTHS, limit: 10) {
id
count
}
}
}
}
```
## Outputs
### `data`
The `data` key of the response body received from the Ackee GraphQL API server.
## Basic Usage
```yaml
steps:
- name: Fetch analytics data from an Ackee GraphQL API server
id: ackee
uses: jackdbd/ackee-action@v1.1.0
with:
endpoint: ${{ secrets.ACKEE_API_ENDPOINT }}
username: ${{ secrets.ACKEE_USERNAME }}
password: ${{ secrets.ACKEE_PASSWORD }}
domain_id: ${{ secrets.ACKEE_DOMAIN_ID }}
- name: Dump data
run: echo ${{ steps.ackee.outputs.data }}
```
## Examples
### Ackee => Telegram weekly report
```yaml
name: 'Ackee to Telegram weekly'
on:
schedule:
# https://crontab.guru/once-a-week
- cron: '0 0 * * 0'
jobs:
ackee-weekly-report:
name: 7️⃣ Ackee weekly report
runs-on: ubuntu-latest
steps:
- name: ⬇️ Fetch data from Ackee
id: ackee
uses: jackdbd/ackee-action@v1.1.0
with:
endpoint: ${{ secrets.ACKEE_API_ENDPOINT }}
username: ${{ secrets.ACKEE_USERNAME }}
password: ${{ secrets.ACKEE_PASSWORD }}
domain_id: ${{ secrets.ACKEE_DOMAIN_ID }}
- name: 📳 Send report to Telegram
uses: appleboy/telegram-action@master
# https://github.com/appleboy/telegram-action
# This is a container action, so it must run on Linux (it would fail if
# `runs-on` is either `windows-latest` or `macos-latest`)
env:
ACKEE_REPORT: ${{ steps.ackee.outputs.data }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
🚀 Ackee weekly report!
${{ env.ACKEE_REPORT }}
```
### Ackee => Slack on demand report
```yaml
name: 'Ackee to Slack on demand'
on:
# allow to trigger this workflow manually
workflow_dispatch:
jobs:
ackee-on-demand-report:
name: Send report on demand
runs-on: ubuntu-latest
steps:
- name: Fetch data from Ackee
id: ackee
uses: jackdbd/ackee-action@v1.1.0
with:
endpoint: ${{ secrets.ACKEE_API_ENDPOINT }}
username: ${{ secrets.ACKEE_USERNAME }}
password: ${{ secrets.ACKEE_PASSWORD }}
domain_id: ${{ secrets.ACKEE_DOMAIN_ID }}
- name: Send report to Slack
uses: pullreminders/slack-action@master
# https://github.com/abinoda/slack-action
# This is a container action, so it must run on Linux
env:
ACKEE_REPORT: ${{ steps.ackee.outputs.data }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
with:
args: '{\"channel\":\"${{ env.SLACK_CHANNEL_ID }}\",\"text\":\"${{ env.ACKEE_REPORT }}\"}'
```
You could use the [GitHub CLI](https://github.com/cli/cli) to trigger the workflow
```sh
# maybe pick a shorter name for your workflow ;-)
gh workflow run 'Ackee to Slack on demand'
```