diff --git a/.circleci/config.yml b/.circleci/config.yml index 0493b8b13ece9..798960607f4c6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1685,6 +1685,18 @@ jobs: MESSAGE: << parameters.message >> LABEL_NAME: << parameters.label_name >> + devnet-metrics-collect-authorship: + 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: @@ -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", <>] + - not: + equal: [scheduled_pipeline, << pipeline.trigger_source >>] + + jobs: + - devnet-metrics-collect-authorship: + context: + - circleci-repo-readonly-authenticated-github-token diff --git a/devnet-sdk/scripts/metrics-collect-authorship.sh b/devnet-sdk/scripts/metrics-collect-authorship.sh new file mode 100755 index 0000000000000..fb20ceeadb49b --- /dev/null +++ b/devnet-sdk/scripts/metrics-collect-authorship.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -eo pipefail + +DIRECTORY=$1 +if [ -z "$DIRECTORY" ]; then + echo "Usage: $0 " + 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 +# - 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 \ No newline at end of file