https://github.com/andry81-devops/gh-action--accum-board-stats
GitHub composite action to request and accumulate a forum board post replies and views statistic. • :page_with_curl: https://github.com/andry81-stats/gh-action--accum-board-stats--gh-stats :page_with_curl:
https://github.com/andry81-devops/gh-action--accum-board-stats
action board github github-action insights replies-badge traffic views-badge
Last synced: about 2 months ago
JSON representation
GitHub composite action to request and accumulate a forum board post replies and views statistic. • :page_with_curl: https://github.com/andry81-stats/gh-action--accum-board-stats--gh-stats :page_with_curl:
- Host: GitHub
- URL: https://github.com/andry81-devops/gh-action--accum-board-stats
- Owner: andry81-devops
- License: mit
- Created: 2021-11-24T02:48:55.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-03T02:38:35.000Z (4 months ago)
- Last Synced: 2025-03-01T08:18:34.448Z (3 months ago)
- Topics: action, board, github, github-action, insights, replies-badge, traffic, views-badge
- Homepage: https://github.com/andry81-devops/accum-content
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.txt
- Funding: .github/FUNDING.yml
- License: license.txt
Awesome Lists containing this project
README
---
Userlog
• Changelog
• Dependencies
• Known issues
•Copyright and License
GitHub composite action to request and accumulate a forum board post replies and views statistic.
Tutorial to use with: https://github.com/andry81-devops/accum-content
All tutorials: https://github.com/andry81/index#tutorials
##
# gh-action--accum-board-stats@master
## Features:
* Repository to track and repository to store traffic statistic can be different, and you may directly point the statistic as commits list:
`https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/board/phpbb`* Workflow is used [accum-stats.sh](https://github.com/andry81-devops/gh-workflow/tree/HEAD/bash/board/accum-stats.sh) bash script to accumulate traffic statistic
* The script accumulates statistic both into a single file and into a set of files grouped by year and allocated per day:
`traffic/board/phpbb/by_year/YYYY/YYYY-MM-DD.json`## Functionality of the script:
* `CONTINUE_ON_INVALID_INPUT=1`, `CONTINUE_ON_EMPTY_CHANGES=1`:
Treats invalid input or empty changes as not an error as by default.* `ENABLE_GENERATE_CHANGELOG_FILE=1`, `CHANGELOG_FILE=".../changelog.txt"`:
Generates a textual changelog file with notes about changes per commit including the changes absence in case of skipped errors.* `ENABLE_COMMIT_MESSAGE_DATE_WITH_TIME=1`:
Inserts the time string in format `HH:MMZ` additionally after the date in each commit message (by default inserts only a date for shorter commit messages).* `ENABLE_COMMIT_MESSAGE_WITH_WORKFLOW_RUN_NUMBER=1`:
Inserts the workflow run number after date/time prefix in each commit message (by default does not insert for shorter commit messages).* `ENABLE_GITHUB_ACTIONS_RUN_URL_PRINT_TO_CHANGELOG=1`:
Prints GitHub Actions Run URL (with or without workflow run number) into the changelog file to reference the log on the GitHub from the changelog file.* `ENABLE_REPO_STATS_COMMITS_URL_PRINT_TO_CHANGELOG=1`:
Prints Statistic Output Repository commit URL into the changelog file to reference the commit from being committed changelog file.> [!NOTE]
> The actual hash of the commit can not be know on the moment of the commit. So instead of the commit hash, an approximate date of the commit is used (~ +5 min ahead) in format of:
> `https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits?branch={{BRANCH}}&time_zone=utc&until=YYYY-MM-DD`* `ENABLE_PRINT_CURL_RESPONSE_ON_ERROR=1`:
Prints curl response in case of an error (by default only the progress prints)# USAGE
> [!WARNING]
> You must replace all placeholder into respective values:* `{{REPO_OWNER}}` -> repository owner
* `{{REPO}}` -> your repository
* `{{BRANCH}}` -> your repository branch or reference
* `{{TOPIC_KEYWORDS}}` -> topic keywords
* `{{TOPIC_AUTHOR}}` -> topic author## Examples:
`.github/workflows/accum-phpbb-board-stats.yml`:
```yml
name: phpbb board stats updating every 4 hourson:
schedule:
- cron: "0 */4 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:jobs:
accum-phpbb-board-stats:
runs-on: ubuntu-lateststeps:
- uses: {{REPO_OWNER}}/gh-action--accum-board-stats@master
with:
# CAUTION: Beware of double quotes strip in case of usage yaml `>-` operator or even a single-quotted string!
topic_query_url: https://phpbb.com/board/search.php?keywords=\"{{TOPIC_KEYWORDS}}\"&terms=all&author={{TOPIC_AUTHOR}}&fid%5B%5D=6&sc=0&sf=titleonly&sr=topics&sk=i&sd=d&st=0&ch=1&t=0&submit=Search
replies_sed_regexp: s/.*class=\"posts\"[^0-9]*([0-9.]+).*/\1/p
views_sed_regexp: s/.*class=\"views\"[^0-9]*([0-9.]+).*/\1/pcurl_flags: >-
-v
-H 'Cache-Control: no-cache'deps_repo_owner: {{REPO_OWNER}}
deps_repo_branch: master
deps_repo_read_token: ${{ github.token }}commit_msg_entity: my-board-1
output_repo_owner: {{REPO_OWNER}}
output_repo: {{REPO}}--phpbb-stats
output_repo_branch: master
output_repo_dir: traffic/board/phpbb
output_repo_write_token: ${{ secrets.READ_STATS_TOKEN }}flags: >-
ENABLE_PRINT_INITIAL_ENV_INTO_STDOUT=1env: >-
ENABLE_GENERATE_CHANGELOG_FILE=1
CHANGELOG_FILE=changelog.txt
ENABLE_PRINT_CURL_RESPONSE_ON_ERROR=1
ENABLE_COMMIT_MESSAGE_DATE_WITH_TIME=1 # insert the time string in format HH:MMZ additionally after the date in each commit message
ENABLE_COMMIT_MESSAGE_WITH_WORKFLOW_RUN_NUMBER=1 # insert the workflow run number after date/time prefix in each commit message
ENABLE_GITHUB_ACTIONS_RUN_URL_PRINT_TO_CHANGELOG=1
ENABLE_REPO_STATS_COMMITS_URL_PRINT_TO_CHANGELOG=1
# ENABLE_YAML_DIFF_PRINT_AFTER_EDIT=1
# ENABLE_YAML_DIFF_PRINT_BEFORE_PATCH=1
# ERROR_ON_EMPTY_CHANGES_WITHOUT_ERRORS=1
# CONTINUE_ON_INVALID_INPUT=1
# CONTINUE_ON_EMPTY_CHANGES=1
```> [!NOTE]
> You can use `secrets.READ_STATS_TOKEN` instead of `secrets.WRITE_STATS_TOKEN` as long as both repositories under the same repository owner.> [!WARNING]
> You must use different values for `deps_repo_owner` and `output_repo_owner` if respective repositories actually under different repository owners.> [!NOTE]
> See REUSE section for details if you have multiple repositories and want to store all GitHub workflow scripts (`.github/workflows/*.yml`) in a single repository.## Dependencies
* https://github.com/andry81-devops/gh-workflow
## Known Issues
https://github.com/andry81-devops/gh-known-issues#known-issues
## Last known issues updates
https://github.com/andry81-devops/gh-known-issues#last-known-issues-updates
## Copyright and License
Code and documentation copyright 2021 Andrey Dibrov. Code released under [MIT License](https://github.com/andry81-devops/gh-action--accum-board-stats/tree/HEAD/license.txt)