Skip to content

Commit

Permalink
Weekly Project Management Digest (internetarchive#9311)
Browse files Browse the repository at this point in the history
* Create workflow for weekly PM digest to slack

- Only publish summary line items that notify Slack user if there is something
actionable
- Include link for issues needing leads
- Replace Slack @ mention with GitHub username in assigned PR summaries
- Changes staff PR summaries to one-liners (instead of two lines per PR)
- `await` the completion of `main()` before printing "finishing" message to console
- Changes `forStaff` to `publishFullDigest`, which better describes what
is happening

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
jimchamp and pre-commit-ci[bot] authored May 24, 2024
1 parent ab0d7a6 commit 2457f0e
Show file tree
Hide file tree
Showing 5 changed files with 564 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"slackChannel": "#openlibrary-leads-g",
"publishFullDigest": false,
"leads": [
{
"githubUsername": "hornc",
"leadLabel": "Lead: @hornc",
"slackId": "<@U0EUS8DV0>"
},
{
"githubUsername": "mheiman",
"leadLabel": "Lead: @mheiman",
"slackId": "<@U01MQBRDN5D>"
},
{
"githubUsername": "RayBB",
"leadLabel": "Lead: @RayBB",
"slackId": "<@U01TC3EG9LJ>"
},
{
"githubUsername": "rebecca-shoptaw",
"leadLabel": "Lead: @rebecca-shoptaw",
"slackId": "<@U06D09YC69L>"
}
]
}
31 changes: 31 additions & 0 deletions .github/workflows/config/weekly_status_report_team_abc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"slackChannel": "#team-abc-plus",
"publishFullDigest": true,
"leads": [
{
"githubUsername": "mekarpeles",
"leadLabel": "Lead: @mekarpeles",
"slackId": "<@U0AB3N5L7>"
},
{
"githubUsername": "cdrini",
"leadLabel": "Lead: @cdrini",
"slackId": "<@U709VCNLD>"
},
{
"githubUsername": "scottbarnes",
"leadLabel": "Lead: @scottbarnes",
"slackId": "<@U03MNR6T7FH>"
},
{
"githubUsername": "seabelis",
"leadLabel": "Lead: @seabelis",
"slackId": "<@UAHQ39ACT>"
},
{
"githubUsername": "jimchamp",
"leadLabel": "Lead: @jimchamp",
"slackId": "<@U01ARTHG9EV>"
}
]
}
35 changes: 35 additions & 0 deletions .github/workflows/weekly_status_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: weekly_status_report
on:
schedule:
- cron: '30 8 * * *' # XXX : set to appropriate time (before ABC)
workflow_dispatch:
permissions:
contents: read
issues: read
env:
NODE_VERSION: '20'
TEAM_ABC_CONFIG: '.github/workflows/config/weekly_status_report_team_abc.json'
LEADS_G_CONFIG: '.github/workflows/config/weekly_status_report_openlibrary_leads_g.json'
jobs:
create_and_publish_report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v4
id: cache-octokit
with:
path: 'node_modules'
key: ${{ runner.os }}-node${{ env.NODE_VERSION}}-octokit-${{ hashFiles('**/package-lock.json') }}
- if: steps.cache-octokit.outputs.cache-hit != 'true'
run: npm install @octokit/action
- run: node scripts/gh_scripts/weekly_status_report.mjs ${{ env.TEAM_ABC_CONFIG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
- run: node scripts/gh_scripts/weekly_status_report.mjs ${{ env.LEADS_G_CONFIG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
47 changes: 47 additions & 0 deletions scripts/gh_scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,50 @@ docker compose exec -e PYTHONPATH=. web bash
```

__Note:__ When adding arguments, be sure to place any hyphenated values within double quotes.

## `weekly_status_report.mjs`

This script prepares a digest of information helpful to leads, and publishes the digest to Slack.

### Usage

<pre><b>node weekly_status_report.mjs</b> config_filepath</pre>
`config_filepath` the location of the script's configuration file

A `SLACK_TOKEN` must be included as an environment variable in order to `POST` to Slack.

Additionally, a `GITHUB_TOKEN` should also be added as an environment variable. `@octokit/action` adds
this to the `octokit` object during instantiation, allowing `octokit` to make authenticated requests
to GitHub.

#### Configuration

A configuration file is required for this script to run properly. The file should contain a JSON string with the following fields:

`slackChannel` : The digest will be published here.

`publishFullDigest` : Boolean that flags whether to publish a full or partial digest. If `false`, the digest will be published without several sections (see **Details**, below).

`leads` : Array of configurations for each lead.

`leads.githubUsername` : The lead's GitHub username.

`leads.leadLabel`: Text of the lead's `Lead: @` label.

`leads.slackId`: The lead's Slack ID in their `mrkdwn` format, which is used to trigger Slack notifications when the message is published.

### Details

The script prepares a digest containing the following sections:

*Recent comments* : A list of links to issues that need comments, broken down by lead.

*Needs: Lead/Assignee* : Lists of pull requests that do not have an assignee, and issues that need a lead. Only present if `publishFullDigest` is `true`.

*Untriaged issues* : List of issues which have the https://github.com/internetarchive/openlibrary/labels/Needs%3A%20Triage label. Only present if `publishFullDigest` is `true`.

*Assigned PRs* : List of pull requests that have been assigned, broken down by lead. Links to higher priority PRs are also included here.

*Staff PRs* : List of all open staff PRs. Only present if `publishFullDigest` is `true`.

*Submitter Input for PRs* : List of PRs that are labeled https://github.com/internetarchive/openlibrary/labels/Needs%3A%20Submitter%20Input, broken down by leads.
Loading

0 comments on commit 2457f0e

Please sign in to comment.