remove monthly report (#6967)

This script is no longer relevant to our internal processes. The report
is now generated by the security team and validated by us, rather than
produced and validated by us.

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Gary Verhaegen 2020-08-04 12:01:07 +02:00 committed by GitHub
parent ab8a77d38d
commit 1ff75f1256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 148 deletions

View File

@ -1,52 +0,0 @@
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Azure Pipelines file, see https://aka.ms/yaml
# Do not run on PRs
pr: none
# Do not run on merge to master
trigger: none
# Run on schedule: first Monday of each month at 6AM UTC
schedules:
- cron: '0 6 1-7 * Mon'
displayName: monthly
branches:
include:
- master
always: true
jobs:
- job: std_change_notif
timeoutInMinutes: 20
pool:
name: 'linux-pool'
demands: assignment -equals default
steps:
- checkout: self
- bash: |
set -euo pipefail
eval "$(./dev-env/bin/dade-assist)"
A_MONTH_AGO=$(date -I -d "now - 1 month")
REPORT_MONTH=${A_MONTH_AGO:0:7}
./report-std-change.sh $REPORT_MONTH
curl -H 'Content-Type: application/json' \
-i \
-XPOST \
$(Slack.team-daml-ci) \
--data "{\"text\": \"<@U6XMLDZEX> Here is the list of \\\"Standard Changes\\\" for the daml repo, month of ${REPORT_MONTH}. Please forward to security@digitalasset.com.\", \"attachments\": [{\"text\": \"\`\`\`$(cat std-change-report-daml-${REPORT_MONTH}.csv | jq -sR | sed 's/^"//' | sed 's/"$//')\`\`\`\"}]}"
if [ -f "std-change-report-daml-${REPORT_MONTH}.csv.err" ]; then
curl -H 'Content-Type: application/json' \
-i \
-XPOST \
$(Slack.team-daml-ci) \
--data "{\"text\": \"<@U6XMLDZEX> The following commits could not be processed. Please manually check them before sending the report.\", \"attachments\": [{\"text\": \"\`\`\`$(cat std-change-report-daml-${REPORT_MONTH}.csv.err | jq -sR | sed 's/^"//' | sed 's/"$//')\`\`\`\"}]}"
fi
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)

View File

@ -1,96 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
AUTH="Authorization: token $GITHUB_TOKEN"
MONTH=$1
START="$MONTH-01T00:00:00+00:00"
END="$(date -Is -u -d "$START + 1 month")"
FULL="$(${FULL+false})"
FILE="${2:-std-change-report-daml-$MONTH.csv}"
ERROR_FILE="${FILE}.err"
SHA_LIST=$(git log --format=%H --after $START --before $END | tac)
echo "Found $(echo $SHA_LIST | wc -w) commits. First: $(echo $SHA_LIST | sed 's/ /\n/g' | head -1), last: $(echo $SHA_LIST | sed 's/ /\n/g' | tail -1)."
TMP=$(mktemp -d)
echo -n "Getting data for each commit..."
mkdir -p "$TMP/commits"
curl -H "$AUTH" \
-H "Accept: application/vnd.github.groot-preview+json" \
--output "$TMP/commits/#1" \
-s \
"https://api.github.com/repos/digital-asset/daml/commits/{$(echo $SHA_LIST | sed 's/ /,/g')}/pulls"
echo " done."
PR_LIST=$(for sha in $SHA_LIST; do cat $TMP/commits/$sha | jq -r '.[] | .number'; done)
echo -n "Getting PR data for each commit..."
mkdir -p "$TMP/pulls"
curl -H "$AUTH" \
--output "$TMP/pulls/#1" \
-s \
"https://api.github.com/repos/digital-asset/daml/pulls/{$(echo $PR_LIST | sed 's/ /,/g')}"
echo " done."
echo -n "Getting issue data for each PR..."
mkdir -p "$TMP/issues"
curl -H "$AUTH" \
--output "$TMP/issues/#1" \
-s \
"https://api.github.com/repos/digital-asset/daml/issues/{$(echo $PR_LIST | sed 's/ /,/g')}"
echo " done."
mkdir -p "$TMP/approvers"
echo -n "Getting approvers data..."
curl -H "$AUTH" \
--output "$TMP/approvers/#1" \
-s \
"https://api.github.com/repos/digital-asset/daml/pulls/{$(echo $PR_LIST | sed 's/ /,/g')}/reviews"
echo " done."
echo "Writing export to $FILE..."
echo "\"date merged\",\"date opened\",\"title\",\"author\",\"approvers\",\"merger\",\"change type\",\"sha\",\"commit link\",\"PR\",\"PR link\"" > "$FILE"
for sha in $SHA_LIST; do
COMMIT_LINK="https://github.com/digital-asset/daml/commit/$sha"
PR=$(cat $TMP/commits/$sha | jq -r '.[] | .number')
if [ -z "$PR" ]; then
echo "$COMMIT_LINK" >> "$ERROR_FILE"
else
PR_URL=$(cat $TMP/commits/$sha | jq -r '.[] | .url')
OPEN_DATE=$(cat $TMP/pulls/$PR | jq ".created_at")
MERGE_DATE=$(cat $TMP/pulls/$PR | jq ".merged_at")
AUTHOR=$(cat $TMP/pulls/$PR | jq '.user.login')
MERGER=$(cat $TMP/pulls/$PR | jq '.merged_by.login')
PR_LINK="https://github.com/digital-asset/daml/pull/$PR"
TITLE=$(cat $TMP/pulls/$PR | jq '.title')
CHANGE_TYPE=$(cat $TMP/issues/$PR | jq 'if [.labels[] | .name] | contains(["Standard-Change"]) then "Standard-Change" else "Routine-Change" end')
APPROVERS=$(cat $TMP/approvers/$PR | jq '[.[] | select(.state=="APPROVED") | .user.login] | join(";")')
if [ "$CHANGE_TYPE" = '"Standard-Change"' ] || [ "$FULL" = "true" ]; then
echo "$MERGE_DATE,$OPEN_DATE,$TITLE,$AUTHOR,$APPROVERS,$MERGER,$CHANGE_TYPE,\"$sha\",\"$COMMIT_LINK\",\"$PR\",\"$PR_LINK\"" >> "$FILE"
fi
fi
done
if [ -f "$ERROR_FILE" ]; then
echo "One or more errors occurred. Please manually check the following commits:"
cat "$ERROR_FILE"
fi