Skip to content

Commit

Permalink
[gh-action]: Generate a weekly report of activity (open-telemetry#26111)
Browse files Browse the repository at this point in the history
**Description:** 

This PR creates a gh action that generates a weekly report on repo
statistics.
It delivers on the requirements specified in
open-telemetry#24672
You can see the sample output here:
kevinslin#16

**Link to tracking Issue:** open-telemetry#24672

**Testing:** 

Manual testing in fork:
https://github.com/kevinslin/opentelemetry-collector-contrib/actions
Example output:
kevinslin#17

**Documentation:** 


The architecture:
- we use `actions/github-script@v6` to make calls to the gh apis
- we require installing `js-yaml` in order to parse `metadata.yaml`
files in order to get components. this dependency is installed during
the github action run and not persisted

Some caveats about the logic:
- when this action runs, it looks back the previous 7 days and gets
issues created in that time period, normalizing times to UTC
- eg. if running this on wednesday (eg. 2023-08-25 17:35:00), it will
scan issues from the previous wednesday (2023-08-18 00:00:00Z) to
beginning of this wednesday (2023-08-28 0:00:00Z)
- this action writes the json payload of the report inside the issue.
the payload is parsed by future reports to calculate deltas
- the report issue has a custom label: `report` - this is used so we can
properly filter previous issues when calculating deltas. the [github
issues
api](https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues)
only does filtering based on labels and `since` date

This action currently runs every Tuesday at 1AM UTC

---------

Co-authored-by: Antoine Toulme <antoine@toulme.name>
Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
  • Loading branch information
3 people authored and jmsnll committed Nov 12, 2023
1 parent b0ecf2f commit 3d37a17
Show file tree
Hide file tree
Showing 2 changed files with 463 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/generate-weekly-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This action generates a weekly report as a github issue
# More details in https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/24672

name: 'Generate Weekly Report'
on:
workflow_dispatch:
schedule:
# run every tuesday at 1am UTC
- cron: "0 1 * * 2"

jobs:
get_issues:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install js-yaml
working-directory: ./.github/workflows/scripts
- uses: actions/github-script@v6
id: get-issues
with:
retries: 3
script: |
const script = require('.github/workflows/scripts/generate-weekly-report.js')
await script({github, context})
Loading

0 comments on commit 3d37a17

Please sign in to comment.