Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,18 @@ jobs:
MESSAGE: << parameters.message >>
LABEL_NAME: << parameters.label_name >>

devnet-metrics-collect-authorship:
docker:
- image: <<pipeline.parameters.default_docker_image>>
steps:
- utils/checkout-with-mise
- run:
name: Collect devnet metrics for op-acceptance-tests
command: ./devnet-sdk/scripts/metrics-collect-authorship.sh op-acceptance-tests/tests > .metrics--authorship--op-acceptance-tests
- store_artifacts:
path: .metrics--authorship--op-acceptance-tests
destination: metrics--authorship--op-acceptance-tests

workflows:
main:
when:
Expand Down Expand Up @@ -2336,3 +2348,16 @@ workflows:
This issue will be closed now."
context:
- circleci-repo-optimism

devnet-metrics-collect:
when:
and:
# FIXME change to develop after testing
- equal: ["jan/metrics--authors", <<pipeline.git.branch>>]
- not:
equal: [scheduled_pipeline, << pipeline.trigger_source >>]

jobs:
- devnet-metrics-collect-authorship:
context:
- circleci-repo-readonly-authenticated-github-token
20 changes: 20 additions & 0 deletions devnet-sdk/scripts/metrics-collect-authorship.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -eo pipefail

DIRECTORY=$1
if [ -z "$DIRECTORY" ]; then
echo "Usage: $0 <directory>"
exit 1
fi

# - We list all the tracked files in the specified directory
# - We blame the files (using porcelain for easy consumption)
# - We take the author emails out of the blame output
# - We replace the <brackets around the emails>
# - We sort the emails and remove duplicates
git ls-files -z "$DIRECTORY" \
| xargs -0n1 git --no-pager blame --porcelain \
| sed -n -e '/^author-mail /s/^author-mail //p' \
| sed -e 's/[<>]//g' \
| sort | uniq