CI: Check for valid cypress tags (#32764)

## Description
Add a check to validate PRs

Fixes #`32763`  


## Automation

/ok-to-test tags=""

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]  
> If you modify the content in this section, you are likely to disrupt
the CI result for your PR.

<!-- end of auto-generated comment: Cypress test results  -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Integrated a new workflow step to validate tags in pull requests,
providing guidance for corrections and halting the workflow if tags are
incorrect.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
yatinappsmith 2024-04-18 13:20:59 +05:30 committed by GitHub
parent 17fed0a270
commit 4e6f3c599e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -72,6 +72,41 @@ jobs:
if: steps.parseTags.outputs.outcome != 'success'
run: exit 1
- name: Check Tags
env:
TAG_LIST: ${{ steps.getTags.outputs.tags }}
id: checkTags
run: |
export IFS=","
for tag in ${TAG_LIST//[[:blank:]]/}; do
if [[ `cat app/client/cypress/tags.js|grep -w $tag|wc -l` != 1 && $tag != "@tag.All" ]]; then
echo "Incorrect Tags"
echo "outcome=failure" >> $GITHUB_OUTPUT
fi
done
shell: bash
# In case of incorrect tags, guides towards correct tags
- name: Add test response with tags list link
if: steps.checkTags.outputs.outcome == 'failure'
uses: nefrob/pr-description@v1.1.1
with:
content: |
<!-- This is an auto-generated comment: Cypress test results -->
> [!WARNING]
> The provided command contains incorrect tags. Please modify PR body, specifying the tags you want to include or use `/ok-to-test tags="@tag.All"` to run all specs.
> Please find complete list of tags [here](https://github.com/appsmithorg/appsmith/blob/release/app/client/cypress/tags.js)
<!-- end of auto-generated comment: Cypress test results -->
regex: "<!-- This is an auto-generated comment: Cypress test results -->.*?<!-- end of auto-generated comment: Cypress test results -->"
regexFlags: ims
token: ${{ secrets.GITHUB_TOKEN }}
# In case of incorrect tags, exit the workflow with failure
- name: Stop the workflow run if tags are incorrect
if: steps.checkTags.outputs.outcome == 'failure'
run: exit 1
# In case of a run with all test cases, allocate a larger matrix
- name: Check if @tag.All is present in tags
id: checkAll