Skip to content

Commit

Permalink
add developer metrics jobs to CircleCI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaele-oplabs committed Dec 19, 2024
1 parent d9583c3 commit bc5b6cf
Showing 1 changed file with 98 additions and 17 deletions.
115 changes: 98 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: 2.1
orbs:
node: circleci/[email protected]
utils: ethereum-optimism/[email protected]

executors:
node20:
Expand Down Expand Up @@ -69,7 +70,7 @@ jobs:
name: Lint Markdown files
command: pnpm lint

build-and-run-lychee:
links:
executor: rust
steps:
- checkout:
Expand Down Expand Up @@ -104,6 +105,74 @@ jobs:
cd docs
lychee --config ./lychee.toml --quiet "./pages"
developer-issue-metrics:
description: Monthly Issue Metrics Report
executor: ubuntu
parameters:
repo:
type: string
default: $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
steps:
- utils/get-github-access-token:
private-key-str: GITHUB_APP_KEY
app-id: GITHUB_APP_ID
repo: << parameters.repo >>
- run:
name: Get Dates for Last Month
command: |
# Calculate the first day of the previous month
first_day=$(date -d "last month" +%Y-%m-01)
# Calculate the last day of the previous month
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
# Export the last_month variable for subsequent steps
echo "export LAST_MONTH=${first_day}..${last_day}" >> $BASH_ENV
- utils/generate-issue-metrics-file:
SEARCH_QUERY: 'repo:ethereum-optimism/docs is:issue closed:${LAST_MONTH} -reason:\"not planned\" -label:monthly-report'
file-path: "./issue_metrics.md"
- utils/create-github-issue-from-file:
repo: << parameters.repo >>
file-path: "./issue_metrics.md"
issue-title: "${LAST_MONTH} metrics report for closed issues"
issue-labels: "monthly-report"
assignees: "sbvegan"

developer-pr-metrics:
description: Monthly PR Metrics Report
executor: ubuntu
parameters:
repo:
type: string
default: $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
steps:
- utils/get-github-access-token:
private-key-str: GITHUB_APP_KEY
app-id: GITHUB_APP_ID
repo: << parameters.repo >>
- run:
name: Get Dates for Last Month
command: |
# Calculate the first day of the previous month
first_day=$(date -d "last month" +%Y-%m-01)
# Calculate the last day of the previous month
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
# Export the last_month variable for subsequent steps
echo "export LAST_MONTH=${first_day}..${last_day}" >> $BASH_ENV
- utils/generate-issue-metrics-file:
SEARCH_QUERY: "repo:ethereum-optimism/docs is:pr created:${LAST_MONTH}"
file-path: "./issue_metrics.md"
- utils/create-github-issue-from-file:
repo: << parameters.repo >>
file-path: "./issue_metrics.md"
issue-title: "${LAST_MONTH} metrics report for opened prs"
issue-labels: "monthly-report"
assignees: "sbvegan"

workflows:
merge-workflow:
jobs:
Expand All @@ -115,19 +184,31 @@ workflows:
only: main
pr-workflow:
jobs:
# - breadcrumbs:
# name: Breadcrumb Check
# filters:
# branches:
# only:
# - main
# - /pull\/\d+/
# - build-and-run-lychee:
# filters:
# branches:
# only:
# - main
# - /pull\/\d+/
- breadcrumbs
- build-and-run-lychee
- lint
- breadcrumbs:
name: Breadcrumb Check
filters:
branches:
only:
- main
- /pull\/\d+/
- links:
filters:
branches:
only:
- main
- /pull\/\d+/
- lint:
filters:
branches:
only:
- main
- /pull\/\d+/

developer-issue-metrics-workflow:
when:
equal: [build_monthly, <<pipeline.schedule.name>>]
jobs:
- developer-issue-metrics:
context: circleci-repo-docs
- developer-pr-metrics:
context: circleci-repo-docs

0 comments on commit bc5b6cf

Please sign in to comment.