Update deployment.yml #285
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
# workflow_dispatch: | |
push: | |
branches-ignore: | |
- master | |
- main | |
- develop | |
name: Verify Existance of Jira Ticket, Design and Test Plan (New) | |
jobs: | |
build: | |
name: Job - Verify Existance of Jira Ticket, Design and Test Plan (New) | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login | |
uses: atlassian/gajira-login@master | |
env: | |
JIRA_BASE_URL: https://runai.atlassian.net/ | |
JIRA_USER_EMAIL: jira-bot@run.ai | |
JIRA_API_TOKEN: ${{ secrets.JIRA_SECRET }} | |
- name: Find Jira ticket in branch name | |
id: ticket | |
uses: run-ai/gajira-find-issue-key@master | |
with: | |
from: branch | |
- name: Verify Jira ticket was found | |
run: | | |
if [ -z ${{steps.ticket.outputs.issue}} ]; then | |
echo "failed to find jira ticket in branch name" | |
exit 1 | |
else | |
echo "found jira ticket: ${{steps.ticket.outputs.issue}}" | |
fi | |
- name: Setup Jira CLI | |
uses: atlassian/gajira-cli@v2.0.2 | |
- name: Verify not epic and that design and test plan fields are filled out | |
run: | | |
export JIRA_API_TOKEN=${{ secrets.JIRA_SECRET }} | |
jira list -q "ID=${{steps.ticket.outputs.issue}} AND type!=Story AND type!=Bug" > /tmp/query1-result.txt | |
cat /tmp/query1-result.txt | |
if [ -s /tmp/query1-result.txt ]; then | |
echo "Rejected: Ticket: ${{steps.ticket.outputs.issue}} is not a bug and not a story" | |
exit 1 | |
else | |
echo "Good: Ticket is a bug or story" | |
fi | |
jira list -q "(ID=${{steps.ticket.outputs.issue}} AND type=Story AND (\"Design[Paragraph]\" is EMPTY OR \"Test Plan[Paragraph]\" is EMPTY))" > /tmp/query2-result.txt | |
cat /tmp/query2-result.txt | |
if [ -s /tmp/query2-result.txt ]; then | |
echo "Rejected: Its a story and either design or a test plan at not filled out in ticket: ${{steps.ticket.outputs.issue}} " | |
exit 1 | |
else | |
echo "All OK. Either its a bug, or a story where both Design and Test Plan fields are filled out in ticket ${{steps.ticket.outputs.issue}}" | |
fi | |
jira list -q "ID=${{steps.ticket.outputs.issue}} AND status=Done" > /tmp/query3-result.txt | |
cat /tmp/query3-result.txt | |
if [ -s /tmp/query3-result.txt ]; then | |
echo "Rejected: Ticket: ${{steps.ticket.outputs.issue}} ticket is already done" | |
exit 1 | |
else | |
echo "Good: Ticket is not done" | |
fi | |