Skip to content

Commit 32a214a

Browse files
wip: Collect authoriship metrics (ethereum-optimism#15527)
1 parent a2864db commit 32a214a

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

‎.circleci/config.yml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,18 @@ jobs:
16831683
MESSAGE: << parameters.message >>
16841684
LABEL_NAME: << parameters.label_name >>
16851685

1686+
devnet-metrics-collect-authorship:
1687+
docker:
1688+
- image: <<pipeline.parameters.default_docker_image>>
1689+
steps:
1690+
- utils/checkout-with-mise
1691+
- run:
1692+
name: Collect devnet metrics for op-acceptance-tests
1693+
command: ./devnet-sdk/scripts/metrics-collect-authorship.sh op-acceptance-tests/tests > .metrics--authorship--op-acceptance-tests
1694+
- store_artifacts:
1695+
path: .metrics--authorship--op-acceptance-tests
1696+
destination: metrics--authorship--op-acceptance-tests
1697+
16861698
workflows:
16871699
main:
16881700
when:
@@ -2294,3 +2306,16 @@ workflows:
22942306
This issue will be closed now."
22952307
context:
22962308
- circleci-repo-optimism
2309+
2310+
devnet-metrics-collect:
2311+
when:
2312+
and:
2313+
# FIXME change to develop after testing
2314+
- equal: ["jan/metrics--authors", <<pipeline.git.branch>>]
2315+
- not:
2316+
equal: [scheduled_pipeline, << pipeline.trigger_source >>]
2317+
2318+
jobs:
2319+
- devnet-metrics-collect-authorship:
2320+
context:
2321+
- circleci-repo-readonly-authenticated-github-token
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -eo pipefail
4+
5+
DIRECTORY=$1
6+
if [ -z "$DIRECTORY" ]; then
7+
echo "Usage: $0 <directory>"
8+
exit 1
9+
fi
10+
11+
# - We list all the tracked files in the specified directory
12+
# - We blame the files (using porcelain for easy consumption)
13+
# - We take the author emails out of the blame output
14+
# - We replace the <brackets around the emails>
15+
# - We sort the emails and remove duplicates
16+
git ls-files -z "$DIRECTORY" \
17+
| xargs -0n1 git --no-pager blame --porcelain \
18+
| sed -n -e '/^author-mail /s/^author-mail //p' \
19+
| sed -e 's/[<>]//g' \
20+
| sort | uniq

0 commit comments

Comments
 (0)