From f91539827b1c6950a93915e4186921003027598d Mon Sep 17 00:00:00 2001 From: Veerkumar Patil <35873990+veerpatil@users.noreply.github.com> Date: Wed, 26 Jul 2023 18:16:09 +0530 Subject: [PATCH 1/5] test paths --- .github/workflows/main.yml | 78 ++++++++++---------------------------- 1 file changed, 21 insertions(+), 57 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ea6447b..187163a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,60 +1,24 @@ -name: Cypress Automation Tests -on: [push] +name: Create issue on commit + +on: + push: + paths: + - '.github/**' + jobs: - job1: - name: cypress-run + create_issue: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - containers: [ 0, 1, 2, 3, 4 ] + permissions: + issues: write steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install Packages - run: npm install - - name: install playwright - run: npx playwright install-deps webkit - - name: Run Tests - run: npx cypress run --env allure=true --spec $(node cypress-parallel.js ${{ matrix.containers }} 5) --browser chrome --headed - - - name: Upload a Build Artifact - uses: actions/upload-artifact@v3.1.1 - if: always() - with: - name: ReportsData - path: allure-results - job2: - name: reports - if: always() - runs-on: ubuntu-latest - needs: job1 - steps: - - name: Download a Build Artifact - uses: actions/download-artifact@v3.0.1 - with: - name: ReportsData - path: allure-results - - name: Get Allure history - uses: actions/checkout@v2 - if: always() - continue-on-error: true - with: - ref: gh-pages - path: gh-pages - - - name: Allure Report action from marketplace - uses: simple-elf/allure-report-action@master - if: always() - with: - allure_results: allure-results - allure_history: allure-history - keep_reports: 20 - - - name: Deploy report to Github Pages - if: always() - uses: peaceiris/actions-gh-pages@v2 - env: - PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PUBLISH_BRANCH: gh-pages - PUBLISH_DIR: allure-history \ No newline at end of file + - name: Create issue using REST API + run: | + curl --request POST \ + --url https://api.github.com/repos/${{ github.repository }}/issues \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + --data '{ + "title": "Automated issue for commit: ${{ github.sha }}", + "body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_." + }' \ + --fail From e0eb99101dff2b7cb25388261675c43f37ce60d3 Mon Sep 17 00:00:00 2001 From: Veerkumar Patil <35873990+veerpatil@users.noreply.github.com> Date: Wed, 26 Jul 2023 18:21:02 +0530 Subject: [PATCH 2/5] Update main.yml to test PR --- .github/workflows/main.yml | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 187163a..d61c6d7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,24 +1,27 @@ name: Create issue on commit - on: - push: - paths: - - '.github/**' + pull_request: + paths: ['*', '.github/**'] + +permissions: + pull-requests: write + +env: + NUMBER: ${{ github.event.number }} + REVIEWERS: '["veertest-review"]' + LABELS: '["Framework Changes"]' jobs: - create_issue: + assign-reviewers-and-labels: + name: Assign T2 Reviewers and Labels to the PR runs-on: ubuntu-latest - permissions: - issues: write steps: - - name: Create issue using REST API + - name: Add Labels to the PR run: | - curl --request POST \ - --url https://api.github.com/repos/${{ github.repository }}/issues \ - --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ - --header 'content-type: application/json' \ - --data '{ - "title": "Automated issue for commit: ${{ github.sha }}", - "body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_." - }' \ - --fail + echo "Adding applicable labels to the PR $NUMBER" + curl -L -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.CHERRYPICK_PAT }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/issues/$NUMBER/labels \ + -d '{"labels": '"$LABELS"'}' From 1b00d8b876dcd9e98830473e1c3792c02d832ca5 Mon Sep 17 00:00:00 2001 From: Veerkumar Patil <35873990+veerpatil@users.noreply.github.com> Date: Wed, 26 Jul 2023 18:23:28 +0530 Subject: [PATCH 3/5] Update main.yml to correct token --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d61c6d7..56af848 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: echo "Adding applicable labels to the PR $NUMBER" curl -L -X POST \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.CHERRYPICK_PAT }}" \ + -H "Authorization: Bearer ${{ secrets..GITHUB_TOKEN }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/${{ github.repository }}/issues/$NUMBER/labels \ -d '{"labels": '"$LABELS"'}' From 806f537e046a80caaacfa0a73f58f992046ae31d Mon Sep 17 00:00:00 2001 From: Veerkumar Patil <35873990+veerpatil@users.noreply.github.com> Date: Wed, 26 Jul 2023 18:24:27 +0530 Subject: [PATCH 4/5] Update main.yml to correct token --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 56af848..b5cb242 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: echo "Adding applicable labels to the PR $NUMBER" curl -L -X POST \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets..GITHUB_TOKEN }}" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/${{ github.repository }}/issues/$NUMBER/labels \ -d '{"labels": '"$LABELS"'}' From 119da112fd923d13f7760f677a6d03efb43f83e3 Mon Sep 17 00:00:00 2001 From: Veerkumar Patil <35873990+veerpatil@users.noreply.github.com> Date: Wed, 26 Jul 2023 19:24:30 +0530 Subject: [PATCH 5/5] Update main.yml to give the custome token name --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5cb242..3517172 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: echo "Adding applicable labels to the PR $NUMBER" curl -L -X POST \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Authorization: Bearer ${{ secrets.Test_Token }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/${{ github.repository }}/issues/$NUMBER/labels \ -d '{"labels": '"$LABELS"'}'