PromucFlow_constructor/.github/workflows/ci-merge-check.yml
yatinappsmith fde3d1e185
ci: Add ci test check command (#20672)
## Description

Add ci test check command

Fixes # (issue)



Media


## Type of change



- New feature (non-breaking change which adds functionality)

## How Has This Been Tested?

- Manual

### Test Plan


### Issues raised during DP testing



## Checklist:
### Dev activity
- [X] My code follows the style guidelines of this project
- [X] I have performed a self-review of my own code
- [X] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [X] My changes generate no new warnings
- [X] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [X] PR is being merged under a feature flag


### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test

---------

Co-authored-by: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-02-24 16:54:51 +05:30

57 lines
2.7 KiB
YAML

on:
#This workflow is only triggered by the ok to test command dispatch
repository_dispatch:
types: [ ci-merge-check-command ]
jobs:
ci-merge-check:
runs-on: ubuntu-latest
steps:
# This step creates a comment on the PR with a link to this workflow run.
- name: Add a comment on the PR with link to workflow run
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.client_payload.pull_request.number }}
body: |
found ci-merge-check ${{ github.event.client_payload.pull_request.number }}
# Timestamp will be used to create cache key
- name: timestamp
run: echo "timestamp=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
- name: Check ci test result
run: |
set -o pipefail
export retval=0
export prnumber=${{ github.event.client_payload.pull_request.number }}
echo "prnumber=$prnumber"
workflowid=`curl --silent https://api.github.com/repos/appsmithorg/appsmith/issues/$prnumber/comments|grep "Tests running at:"|grep -Eo 'https://github[^ >]+'|tail -1|awk -F/ '{print $8}'`
export retval=`expr $retval + $?`
echo "workflowid=$workflowid"
runsatatus=`curl --silent https://api.github.com/repos/appsmithorg/appsmith/actions/runs/$workflowid/jobs?per_page=100|jq -r '[ .jobs[] | select(.name | contains("ci-test-result")) | .conclusion ]'|grep -v '\[\|\]'|sed "s/\"//g"|sed "s/ //g"`
export retval=`expr $retval + $?`
echo "runsatatus=$runsatatus"
statuslink=`curl --silent https://api.github.com/repos/appsmithorg/appsmith/pulls/$prnumber|jq -r '[ ._links |.statuses | .href]'|grep http|sed "s/\"//g"|sed "s/ //g"`
export retval=`expr $retval + $?`
echo $retval
echo "statuslink=$statuslink"
pendingchecks=`curl --silent $statuslink|jq -r '.[]'|jq -r '[ select(.state | contains("pending")) | .context ]'`
set +o pipefail
pendingchecks=`echo $pendingchecks|grep -v '\[\|\]'|grep -v 'cypress\|Vercel\|DeepSource'|wc -l`
export retval=`expr $retval + $pendingchecks`
echo $retval
exit $retval
#- name: automerge
# uses: "pascalgn/automerge-action@v0.15.5"
# env:
# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Add a comment on the PR with status
if: failure()
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.client_payload.pull_request.number }}
body: |
Won't merge.Other checks failing.