From 4759815eddc9bcb5746813f94351f9bb5c78bb88 Mon Sep 17 00:00:00 2001 From: AkshaySharma-BharatP Date: Tue, 17 Oct 2023 16:56:53 +0530 Subject: [PATCH 1/7] testing --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9134ba8..7fa31d4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,8 +1,6 @@ name: "Bump Version" -on: - push: - branches: [main, master] +on: [pull_request] jobs: bump-version: From bb451f90436f6027285c69d44568212512e4b694 Mon Sep 17 00:00:00 2001 From: AkshaySharma-BharatP Date: Wed, 1 Nov 2023 19:16:21 +0530 Subject: [PATCH 2/7] test --- .github/workflows/new1.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/new1.yml diff --git a/.github/workflows/new1.yml b/.github/workflows/new1.yml new file mode 100644 index 0000000..55e264a --- /dev/null +++ b/.github/workflows/new1.yml @@ -0,0 +1,16 @@ +name: My Workflow + +on: [push] + +jobs: + runMultipleCommands: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: | + echo "A initial message" + pip install -r requirements.txt + echo "Another message or command" + python myscript.py + bash some-shell-script-file.sh -xe + - run: echo "One last message" From 90b0f403e6de31d9f7e75d8e8bec4598dd6ed02e Mon Sep 17 00:00:00 2001 From: AkshaySharma-BharatP Date: Wed, 1 Nov 2023 19:18:44 +0530 Subject: [PATCH 3/7] hhe --- .github/workflows/new1.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/new1.yml b/.github/workflows/new1.yml index 55e264a..81f17cd 100644 --- a/.github/workflows/new1.yml +++ b/.github/workflows/new1.yml @@ -9,8 +9,9 @@ jobs: - uses: actions/checkout@v1 - run: | echo "A initial message" - pip install -r requirements.txt - echo "Another message or command" - python myscript.py - bash some-shell-script-file.sh -xe + if true; then + echo "print true" + else + echo "else inside" + exit 1 - run: echo "One last message" From e7f3ebf64b36ee01dcb698edd2bcf0d716d82a4c Mon Sep 17 00:00:00 2001 From: AkshaySharma-BharatP Date: Wed, 1 Nov 2023 19:22:10 +0530 Subject: [PATCH 4/7] test2 --- .github/workflows/new1.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/new1.yml b/.github/workflows/new1.yml index 81f17cd..e8581e7 100644 --- a/.github/workflows/new1.yml +++ b/.github/workflows/new1.yml @@ -1,17 +1,19 @@ -name: My Workflow +name: If Else Echo Run Script -on: [push] +on: + push: + branches: + - main jobs: - runMultipleCommands: + run-script: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v1 - - run: | - echo "A initial message" - if true; then - echo "print true" - else - echo "else inside" - exit 1 - - run: echo "One last message" + - name: Run If Else Script + run: | + if [[ "${{ github.event_name }}" == "push" ]]; then + echo "Event was a push" + else + echo "Event was not a push" + fi From a4ccd27d726806fa618e4f1b52b67f65d22cb214 Mon Sep 17 00:00:00 2001 From: AkshaySharma-BharatP Date: Wed, 1 Nov 2023 19:23:12 +0530 Subject: [PATCH 5/7] test2 --- .github/workflows/new1.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/new1.yml b/.github/workflows/new1.yml index e8581e7..7859d61 100644 --- a/.github/workflows/new1.yml +++ b/.github/workflows/new1.yml @@ -1,9 +1,6 @@ name: If Else Echo Run Script -on: - push: - branches: - - main +on: [push] jobs: run-script: From 1b8a4af7759446d140b72ce6d8c516690fc0981c Mon Sep 17 00:00:00 2001 From: AkshaySharma-BharatP Date: Wed, 1 Nov 2023 19:25:37 +0530 Subject: [PATCH 6/7] test2 --- .github/workflows/new1.yml | 47 +++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/.github/workflows/new1.yml b/.github/workflows/new1.yml index 7859d61..ea0aace 100644 --- a/.github/workflows/new1.yml +++ b/.github/workflows/new1.yml @@ -1,4 +1,4 @@ -name: If Else Echo Run Script +name: Check Branch Name and Verify JIRA ID on JIRA Board on: [push] @@ -14,3 +14,48 @@ jobs: else echo "Event was not a push" fi + + - name: Check Branch Name + id: check-branch + run: | + branch_name="${GITHUB_REF#refs/heads/}" + if [[ $branch_name =~ [A-Z]{2,5}-[0-9]+ ]]; then + echo "Branch name contains a JIRA ID: $branch_name" + echo "::set-output name=jira_id::$branch_name" + else + echo "Branch name does not contain a JIRA ID: $branch_name" + exit 1 + fi + +# on: +# push: +# branches: +# - main +# permissions: +# contents: write +# pull-requests: write + +# jobs: +# check-branch-and-verify-jira-id: +# runs-on: ubuntu-latest + +# steps: +# - name: Check Branch Name +# id: check-branch +# run: | +# branch_name="${GITHUB_REF#refs/heads/}" +# if [[ $branch_name =~ [A-Z]{2,5}-[0-9]+ ]]; then +# echo "Branch name contains a JIRA ID: $branch_name" +# echo "::set-output name=jira_id::$branch_name" +# else +# echo "Branch name does not contain a JIRA ID: $branch_name" +# exit 1 +# fi +# - name: Verify JIRA ID on JIRA Board +# id: verify-jira-id +# run: | +# jira_id="${{ steps.check-branch.outputs.jira_id }}" +# jira_url="https://your-jira-instance.atlassian.net/rest/api/2/issue/$jira_id" + +# # Replace 'your-jira-username' and 'your-jira-api-token' with your Jira credentials +# curl -u your-jira-username:your-jira-api-token -X GET -H "Content-Type: application/json" $jira_url | grep -q 'id' && echo "JIRA ID $jira_id exists on the JIRA board" || (echo "JIRA ID $jira_id does not exist on the JIRA board" && exit 1) From 9ad35a8e283d4715489e62a9bc4a7261fe4552e0 Mon Sep 17 00:00:00 2001 From: AkshaySharma-BharatP Date: Wed, 1 Nov 2023 19:27:29 +0530 Subject: [PATCH 7/7] test2 --- .github/workflows/new1.yml | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/.github/workflows/new1.yml b/.github/workflows/new1.yml index ea0aace..c745ebd 100644 --- a/.github/workflows/new1.yml +++ b/.github/workflows/new1.yml @@ -27,35 +27,11 @@ jobs: exit 1 fi -# on: -# push: -# branches: -# - main -# permissions: -# contents: write -# pull-requests: write - -# jobs: -# check-branch-and-verify-jira-id: -# runs-on: ubuntu-latest - -# steps: -# - name: Check Branch Name -# id: check-branch -# run: | -# branch_name="${GITHUB_REF#refs/heads/}" -# if [[ $branch_name =~ [A-Z]{2,5}-[0-9]+ ]]; then -# echo "Branch name contains a JIRA ID: $branch_name" -# echo "::set-output name=jira_id::$branch_name" -# else -# echo "Branch name does not contain a JIRA ID: $branch_name" -# exit 1 -# fi -# - name: Verify JIRA ID on JIRA Board -# id: verify-jira-id -# run: | -# jira_id="${{ steps.check-branch.outputs.jira_id }}" -# jira_url="https://your-jira-instance.atlassian.net/rest/api/2/issue/$jira_id" + - name: Verify JIRA ID on JIRA Board + id: verify-jira-id + run: | + jira_id="${{ steps.check-branch.outputs.jira_id }}" + jira_url="https://your-jira-instance.atlassian.net/rest/api/2/issue/$jira_id" -# # Replace 'your-jira-username' and 'your-jira-api-token' with your Jira credentials -# curl -u your-jira-username:your-jira-api-token -X GET -H "Content-Type: application/json" $jira_url | grep -q 'id' && echo "JIRA ID $jira_id exists on the JIRA board" || (echo "JIRA ID $jira_id does not exist on the JIRA board" && exit 1) + # Replace 'your-jira-username' and 'your-jira-api-token' with your Jira credentials + curl -u your-jira-username:your-jira-api-token -X GET -H "Content-Type: application/json" $jira_url | grep -q 'id' && echo "JIRA ID $jira_id exists on the JIRA board" || (echo "JIRA ID $jira_id does not exist on the JIRA board" && exit 1)