In CodeCommit, Is there a support to list PullRequests in console to filter by lastActivityDate by passing any querystring?

0

Console does not allow filtering view of PullRequests list by last activity date. Is there any internal querystring param that can be sent to filter like lastActivityDate < 7 days

https://us-east-1.console.aws.amazon.com/codesuite/codecommit/repositories/<reponame>/pull-requests?region=us-east-1&status=OPEN

gefragt vor 2 Jahren293 Aufrufe
1 Antwort
0

Hi there,

Hope you are doing well! I understand you want to know if there is a filter on the CodeCommit Console so you can filter out PullRequests activities.

Currently, there is no filter on the CodeCommit Console. Alternatively, you may consider using AWS API/CLI command, which can filter it using the following script:

RepoName="RepoName" #Please change the Repo name
todate="2022-12-20"   #Please change the date you want to find by
todateN=$(date -d $todate +%s)

aws codecommit list-pull-requests --repository-name  $RepoName | jq -c '.pullRequestIds[]' | while read prID; do
    prNumber=$(echo "${prID//\"}")  # remove "
    prDetetails=$(aws codecommit get-pull-request --pull-request-id $prNumber)
    # echo $prDetetails | jq '.pullRequest.lastActivityDate'
    prNumber=$(echo "${prID//\"}")  # remove "
    prLastActivityDateTime=$(echo $prDetetails | jq '.pullRequest.lastActivityDate')
    prLastActivityDate=$(echo $prLastActivityDateTime| awk '{ print substr( $0, 2, length($0)-24 ) }')
    # echo prLastActivityDate: $prLastActivityDate
    prLastActivityDateN=$(date -d $prLastActivityDate +%s)
    #echo prLastActivityDate: $prLastActivityDate $prLastActivityDateN 
    if [ $prLastActivityDateN -ge $todateN ];
    then
        echo $prDetetails | jq '.pullRequest | "\(.pullRequestId) \(.lastActivityDate)"'
    fi  
done

Please note that the code above is for your use-case reference only, effort for developing and debugging your own code is required.

AWS
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen