From bc5b6cfbd94838ec849254ee0b25cb1947fe4642 Mon Sep 17 00:00:00 2001 From: raffaele-oplabs Date: Thu, 19 Dec 2024 19:55:56 +0100 Subject: [PATCH] add developer metrics jobs to CircleCI configuration --- .circleci/config.yml | 115 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 98 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4793035b..7c991259 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,7 @@ version: 2.1 orbs: node: circleci/node@7.0.0 + utils: ethereum-optimism/circleci-utils@0.0.6 executors: node20: @@ -69,7 +70,7 @@ jobs: name: Lint Markdown files command: pnpm lint - build-and-run-lychee: + links: executor: rust steps: - checkout: @@ -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: @@ -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, <>] + jobs: + - developer-issue-metrics: + context: circleci-repo-docs + - developer-pr-metrics: + context: circleci-repo-docs