From 975d497218885ca1db6a6df28e47f0cea8f59440 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Wed, 18 Sep 2024 17:26:58 +0530 Subject: [PATCH 01/84] Added the basic pipeline code --- .github/octokit/index.js | 27 ++++++++++++++++++++++++ .github/octokit/package.json | 16 ++++++++++++++ .github/workflows/pr.yml | 41 ++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 .github/octokit/index.js create mode 100644 .github/octokit/package.json create mode 100644 .github/workflows/pr.yml diff --git a/.github/octokit/index.js b/.github/octokit/index.js new file mode 100644 index 000000000..78efdd295 --- /dev/null +++ b/.github/octokit/index.js @@ -0,0 +1,27 @@ +import {Octokit} from "@octokit/rest"; +import {createAppAuth} from "@octokit/auth-app" + +export const getAccessToken = async () => { + + const {GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY} = process.env + + const octoKitInstance = new Octokit({ + authStrategy: createAppAuth, + auth: { + appId: GITHUB_APP_ID, + privateKey: GITHUB_APP_PRIVATE_KEY + } + }); + + const {data: installations} = await octoKitInstance.rest.apps.listInstallations() + + if(!installations.length) { + throw new Error("No Installations found for this github app") + } + + const installationId = installations[0].id; + + const installationAccessToken = await octoKitInstance.rest.apps.createInstallationAccessToken({installation_id: installationId}) + + return installationAccessToken.data.token +} \ No newline at end of file diff --git a/.github/octokit/package.json b/.github/octokit/package.json new file mode 100644 index 000000000..66fb13cae --- /dev/null +++ b/.github/octokit/package.json @@ -0,0 +1,16 @@ +{ + "name": "xero-octokit", + "version": "1.0.0", + "description": "", + "main": "index.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "@octokit/auth-app": "^7.1.1", + "@octokit/rest": "^21.0.2" + } + } \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000..85886f59e --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,41 @@ +name: Open API PR check + +on: + pull_request: + paths: + - '**' + +jobs: + pr-health-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout codegen repo + uses: actions/checkout@v4 + with: + repository: xero-internal/xeroapi-sdk-codegen + path: xeroapi-sdk-codegen + + # - name: Install octokit dependencies + # run: npm i + # working-directory: xeroapi-sdk-codegen/.github/octokit + + # - name: Get github app access token + # id: get_access_token + # env: + # GITHUB_APP_ID: ${{ secrets.XERO_GITHUB_APP_ID }} + # GITHUB_APP_PRIVATE_KEY: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} + # uses: actions/github-script@v7 + # with: + # result-encoding: string + # script: | + # const { getAccessToken } = await import('${{ github.workspace }}/xeroapi-sdk-codegen/.github/octokit/index.js') + # const token = await getAccessToken() + # return token + + # - name: Checkout xero-node repo + # uses: actions/checkout@v4 + # with: + # repository: XeroAPI/xero-node + # path: xero-node + # token: ${{steps.get_access_token.outputs.result}} \ No newline at end of file From 576f30d01f9661ff56bef984ec4031a6683773eb Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Wed, 18 Sep 2024 19:35:24 +0530 Subject: [PATCH 02/84] commented the JIRA workflow --- .github/workflows/jira_create_issue.yml | 94 +++++++++---------- .../workflows/jira_update_issue_closed.yml | 78 +++++++-------- .../workflows/jira_update_issue_reopen.yml | 78 +++++++-------- 3 files changed, 125 insertions(+), 125 deletions(-) diff --git a/.github/workflows/jira_create_issue.yml b/.github/workflows/jira_create_issue.yml index e334d1daf..cfe0719df 100644 --- a/.github/workflows/jira_create_issue.yml +++ b/.github/workflows/jira_create_issue.yml @@ -1,55 +1,55 @@ -name: Create Issue In Jira +# name: Create Issue In Jira -on: - issues: - types: - - opened - pull_request_target: - types: - - opened - workflow_call: +# on: +# issues: +# types: +# - opened +# pull_request_target: +# types: +# - opened +# workflow_call: -jobs: - create_jira_issue: - name: Create Jira Issue - runs-on: ubuntu-latest - permissions: write-all +# jobs: +# create_jira_issue: +# name: Create Jira Issue +# runs-on: ubuntu-latest +# permissions: write-all - steps: +# steps: - - name: Checkout - uses: actions/checkout@master +# - name: Checkout +# uses: actions/checkout@master - - name: Login - uses: atlassian/gajira-login@master - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} +# - name: Login +# uses: atlassian/gajira-login@master +# env: +# JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} +# JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} +# JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - # Create new ticket in Jira - - name: Create - id: create - uses: atlassian/gajira-create@v3 - with: - project: PETOSS - issuetype: Story - summary: ${{ github.event.repository.name }} ${{ github.event.issue.number || github.event.pull_request.number }} ${{ github.event.issue.title || github.event.pull_request.title }} - description: ${{ github.event.issue.body || github.event.pull_request.body }} +# # Create new ticket in Jira +# - name: Create +# id: create +# uses: atlassian/gajira-create@v3 +# with: +# project: PETOSS +# issuetype: Story +# summary: ${{ github.event.repository.name }} ${{ github.event.issue.number || github.event.pull_request.number }} ${{ github.event.issue.title || github.event.pull_request.title }} +# description: ${{ github.event.issue.body || github.event.pull_request.body }} - # Add created jira id as comment in issue thread. This allows us to easily - # retrieve the id when the issue state is updated, i.e. closed - - name: Add jira ticket id as comment - uses: peter-evans/create-or-update-comment@v2 - with: - issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} - body: ${{ steps.create.outputs.issue }} - token: ${{ secrets.GITHUB_TOKEN }} +# # Add created jira id as comment in issue thread. This allows us to easily +# # retrieve the id when the issue state is updated, i.e. closed +# - name: Add jira ticket id as comment +# uses: peter-evans/create-or-update-comment@v2 +# with: +# issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} +# body: ${{ steps.create.outputs.issue }} +# token: ${{ secrets.GITHUB_TOKEN }} - # Add additional comment to let user know what is happening - - name: Add additional comment notifying user that a ticket has been created - uses: peter-evans/create-or-update-comment@v2 - with: - issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} - body: Thanks for raising an issue, a ticket has been created to track your request - token: ${{ secrets.GITHUB_TOKEN }} +# # Add additional comment to let user know what is happening +# - name: Add additional comment notifying user that a ticket has been created +# uses: peter-evans/create-or-update-comment@v2 +# with: +# issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} +# body: Thanks for raising an issue, a ticket has been created to track your request +# token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/jira_update_issue_closed.yml b/.github/workflows/jira_update_issue_closed.yml index 0ff167953..5003e0a7b 100644 --- a/.github/workflows/jira_update_issue_closed.yml +++ b/.github/workflows/jira_update_issue_closed.yml @@ -1,45 +1,45 @@ -name: Update Issue In Jira When Issue Closed +# name: Update Issue In Jira When Issue Closed -on: - issues: - types: - - closed - pull_request_target: - types: - - closed +# on: +# issues: +# types: +# - closed +# pull_request_target: +# types: +# - closed - workflow_call: -jobs: - update_jira_status: - name: Set Jira Status To Done - runs-on: ubuntu-latest - permissions: write-all +# workflow_call: +# jobs: +# update_jira_status: +# name: Set Jira Status To Done +# runs-on: ubuntu-latest +# permissions: write-all - steps: - # Look through all comments in issue and get contents of comment that - # includes text PETOSS - - name: Find Jira ticket Id in issue comments - uses: peter-evans/find-comment@v2 - id: fc - with: - issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} - body-includes: PETOSS - comment-author: github-actions[bot] - direction: last +# steps: +# # Look through all comments in issue and get contents of comment that +# # includes text PETOSS +# - name: Find Jira ticket Id in issue comments +# uses: peter-evans/find-comment@v2 +# id: fc +# with: +# issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} +# body-includes: PETOSS +# comment-author: github-actions[bot] +# direction: last - - name: Checkout - uses: actions/checkout@master +# - name: Checkout +# uses: actions/checkout@master - - name: Login - uses: atlassian/gajira-login@master - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} +# - name: Login +# uses: atlassian/gajira-login@master +# env: +# JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} +# JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} +# JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - # Transition jira ticket identified in first step to status of done - - name: Update Jira ticket status - uses: atlassian/gajira-transition@v3 - with: - issue: ${{ steps.fc.outputs.comment-body }} - transition: "Done" +# # Transition jira ticket identified in first step to status of done +# - name: Update Jira ticket status +# uses: atlassian/gajira-transition@v3 +# with: +# issue: ${{ steps.fc.outputs.comment-body }} +# transition: "Done" diff --git a/.github/workflows/jira_update_issue_reopen.yml b/.github/workflows/jira_update_issue_reopen.yml index 890c10e74..aaf3dd609 100644 --- a/.github/workflows/jira_update_issue_reopen.yml +++ b/.github/workflows/jira_update_issue_reopen.yml @@ -1,45 +1,45 @@ -name: Reopen Jira Ticket When Issue Reopens +# name: Reopen Jira Ticket When Issue Reopens -on: - issues: - types: - - reopened - pull_request_target: - types: - - reopened +# on: +# issues: +# types: +# - reopened +# pull_request_target: +# types: +# - reopened - workflow_call: -jobs: - update_jira_status: - name: Set Jira Status To Done - runs-on: ubuntu-latest - permissions: write-all +# workflow_call: +# jobs: +# update_jira_status: +# name: Set Jira Status To Done +# runs-on: ubuntu-latest +# permissions: write-all - steps: - # Look through all comments in issue and get contents of comment that - # includes text PETOSS - - name: Find Jira ticket Id in issue comments - uses: peter-evans/find-comment@v2 - id: fc - with: - issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} - body-includes: PETOSS - comment-author: github-actions[bot] - direction: last +# steps: +# # Look through all comments in issue and get contents of comment that +# # includes text PETOSS +# - name: Find Jira ticket Id in issue comments +# uses: peter-evans/find-comment@v2 +# id: fc +# with: +# issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} +# body-includes: PETOSS +# comment-author: github-actions[bot] +# direction: last - - name: Checkout - uses: actions/checkout@master +# - name: Checkout +# uses: actions/checkout@master - - name: Login - uses: atlassian/gajira-login@master - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} +# - name: Login +# uses: atlassian/gajira-login@master +# env: +# JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} +# JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} +# JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - # Transition jira ticket identified in first step to status of backlog - - name: Update Jira ticket status - uses: atlassian/gajira-transition@v3 - with: - issue: ${{ steps.fc.outputs.comment-body }} - transition: "Backlog" +# # Transition jira ticket identified in first step to status of backlog +# - name: Update Jira ticket status +# uses: atlassian/gajira-transition@v3 +# with: +# issue: ${{ steps.fc.outputs.comment-body }} +# transition: "Backlog" From ed6b8ea07541e6ffc4d514c63d6013fedfeca3af Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 19 Sep 2024 10:51:01 +0530 Subject: [PATCH 03/84] yaml linting code --- .github/workflows/pr.yml | 34 +++++++++++++++++++++++++++++++--- xero_files.yaml | 2 +- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 85886f59e..623ce38ba 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -10,11 +10,39 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout codegen repo + - name: Checkout Repository uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 with: - repository: xero-internal/xeroapi-sdk-codegen - path: xeroapi-sdk-codegen + python-version: '3.x' + + - name: Install yaml lint + run: pip install yamllint + + - name: Get list of changed files + id: changed_files + run: | + git fetch origin ${{github.base_ref}} --depth=1 + git diff --name-only origin/${{github.base_ref}}...HEAD > changed_files.txt + grep -E '\.ya?ml$' changed_files.txt > yaml_files.txt || true + + - name: Run yaml lint on changed files + run: | + if [ -s yaml_files.txt ]; then + echo "Linting the following yaml files:" + cat yaml_files.txt + xargs yamllint < yaml_files.txt + else + echo 'no yaml files changed' + fi + + # - name: Checkout codegen repo + # uses: actions/checkout@v4 + # with: + # repository: xero-internal/xeroapi-sdk-codegen + # path: xeroapi-sdk-codegen # - name: Install octokit dependencies # run: npm i diff --git a/xero_files.yaml b/xero_files.yaml index a2a5ae796..53346e9a7 100644 --- a/xero_files.yaml +++ b/xero_files.yaml @@ -32,7 +32,7 @@ paths: schema: type: integer maximum: 100 - example: 50 + example: 50000 - in: query name: page description: number of records to skip for pagination From 53f303ea4ca1bd8ee9546623e0ec21022c04e5da Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 19 Sep 2024 11:36:50 +0530 Subject: [PATCH 04/84] adjusted the yamllint code --- .github/workflows/pr.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 623ce38ba..607cc0e3a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -21,21 +21,16 @@ jobs: - name: Install yaml lint run: pip install yamllint - - name: Get list of changed files - id: changed_files + - name: Run yamllint run: | - git fetch origin ${{github.base_ref}} --depth=1 - git diff --name-only origin/${{github.base_ref}}...HEAD > changed_files.txt - grep -E '\.ya?ml$' changed_files.txt > yaml_files.txt || true + git checkout ${{github.head_ref}} + + find . -type f \( - name "*.yaml" \) > yaml_files.txt - - name: Run yaml lint on changed files - run: | if [ -s yaml_files.txt ]; then - echo "Linting the following yaml files:" - cat yaml_files.txt - xargs yamllint < yaml_files.txt - else - echo 'no yaml files changed' + echo "linting the following yaml files:" + cat yaml_files.txt + xargs yamllint < yaml_files.txt fi # - name: Checkout codegen repo From e7d0a6bd20d0057f2b9a1cf1be9d8ec59543ae9a Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 19 Sep 2024 12:03:09 +0530 Subject: [PATCH 05/84] added git fetch --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 607cc0e3a..4674561a1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -23,8 +23,8 @@ jobs: - name: Run yamllint run: | + git fetch git checkout ${{github.head_ref}} - find . -type f \( - name "*.yaml" \) > yaml_files.txt if [ -s yaml_files.txt ]; then From 6d66ca0dbaf661f0eb655383591379334a011fe3 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 19 Sep 2024 12:07:48 +0530 Subject: [PATCH 06/84] corrected the find command syntax --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4674561a1..49f32140c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -23,9 +23,9 @@ jobs: - name: Run yamllint run: | - git fetch + git fetch > /dev/null 2>&1 git checkout ${{github.head_ref}} - find . -type f \( - name "*.yaml" \) > yaml_files.txt + find . -type f \( -name "*.yaml" \) > yaml_files.txt if [ -s yaml_files.txt ]; then echo "linting the following yaml files:" From 022a462e99ab2bad162dda099aa40f59136e80eb Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 19 Sep 2024 14:05:12 +0530 Subject: [PATCH 07/84] added the github app access token step --- .github/workflows/pr.yml | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 49f32140c..42070179d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -21,23 +21,31 @@ jobs: - name: Install yaml lint run: pip install yamllint - - name: Run yamllint - run: | - git fetch > /dev/null 2>&1 - git checkout ${{github.head_ref}} - find . -type f \( -name "*.yaml" \) > yaml_files.txt + # - name: Run yamllint + # run: | + # git fetch > /dev/null 2>&1 + # git checkout ${{github.head_ref}} + # find . -type f \( -name "*.yaml" \) > yaml_files.txt - if [ -s yaml_files.txt ]; then - echo "linting the following yaml files:" - cat yaml_files.txt - xargs yamllint < yaml_files.txt - fi + # if [ -s yaml_files.txt ]; then + # echo "linting the following yaml files:" + # cat yaml_files.txt + # xargs yamllint < yaml_files.txt + # fi - # - name: Checkout codegen repo - # uses: actions/checkout@v4 - # with: - # repository: xero-internal/xeroapi-sdk-codegen - # path: xeroapi-sdk-codegen + - name: Get github app access token + uses: actions/create-github-app-token@v1 + id: get_access_token + with: + app-id: ${{ secrets.XERO_GITHUB_APP_ID }} + private-key: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} + + - name: Checkout codegen repo + uses: actions/checkout@v4 + with: + repository: xero-internal/xeroapi-sdk-codegen + path: xeroapi-sdk-codegen + token: ${{ steps.app-get_access_token.outputs.token }} # - name: Install octokit dependencies # run: npm i From 84da4d1c9a5a0130b147e79610729ee611627f5d Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 19 Sep 2024 14:17:39 +0530 Subject: [PATCH 08/84] added the octokit code --- .github/workflows/pr.yml | 54 ++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 42070179d..8e6baef3c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -33,40 +33,40 @@ jobs: # xargs yamllint < yaml_files.txt # fi + # - name: Get github app access token + # uses: actions/create-github-app-token@v1 + # id: get_access_token + # with: + # app-id: ${{ secrets.XERO_GITHUB_APP_ID }} + # private-key: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} + + - name: Install octokit dependencies + run: npm i + working-directory: xeroapi-sdk-codegen/.github/octokit + - name: Get github app access token - uses: actions/create-github-app-token@v1 id: get_access_token + env: + GITHUB_APP_ID: ${{ secrets.XERO_GITHUB_APP_ID }} + GITHUB_APP_PRIVATE_KEY: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} + uses: actions/github-script@v7 with: - app-id: ${{ secrets.XERO_GITHUB_APP_ID }} - private-key: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} + result-encoding: string + script: | + const { getAccessToken } = await import('${{ github.workspace }}/xeroapi-sdk-codegen/.github/octokit/index.js') + const token = await getAccessToken() + return token - name: Checkout codegen repo uses: actions/checkout@v4 with: repository: xero-internal/xeroapi-sdk-codegen path: xeroapi-sdk-codegen - token: ${{ steps.app-get_access_token.outputs.token }} - - # - name: Install octokit dependencies - # run: npm i - # working-directory: xeroapi-sdk-codegen/.github/octokit - - # - name: Get github app access token - # id: get_access_token - # env: - # GITHUB_APP_ID: ${{ secrets.XERO_GITHUB_APP_ID }} - # GITHUB_APP_PRIVATE_KEY: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} - # uses: actions/github-script@v7 - # with: - # result-encoding: string - # script: | - # const { getAccessToken } = await import('${{ github.workspace }}/xeroapi-sdk-codegen/.github/octokit/index.js') - # const token = await getAccessToken() - # return token + token: ${{ steps.get_access_token.outputs.result }} - # - name: Checkout xero-node repo - # uses: actions/checkout@v4 - # with: - # repository: XeroAPI/xero-node - # path: xero-node - # token: ${{steps.get_access_token.outputs.result}} \ No newline at end of file + - name: Checkout xero-node repo + uses: actions/checkout@v4 + with: + repository: XeroAPI/xero-node + path: xero-node + token: ${{steps.get_access_token.outputs.result}} \ No newline at end of file From 99b1cd005bc946454e59545cdd809a96e90c99db Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 19 Sep 2024 14:20:14 +0530 Subject: [PATCH 09/84] added github workspace --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8e6baef3c..6ab1546c3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -42,7 +42,7 @@ jobs: - name: Install octokit dependencies run: npm i - working-directory: xeroapi-sdk-codegen/.github/octokit + working-directory: ${{ github.workspace }}/.github/octokit - name: Get github app access token id: get_access_token @@ -53,7 +53,7 @@ jobs: with: result-encoding: string script: | - const { getAccessToken } = await import('${{ github.workspace }}/xeroapi-sdk-codegen/.github/octokit/index.js') + const { getAccessToken } = await import('${{ github.workspace }}/.github/octokit/index.js') const token = await getAccessToken() return token From da45a501b0dec03c06b3fa83db52e9c8e5e5ce94 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 19 Sep 2024 16:12:27 +0530 Subject: [PATCH 10/84] added a test change in files.yaml --- .github/workflows/pr.yml | 7 ------- xero_files.yaml | 10 ++++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6ab1546c3..55604c21a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -32,13 +32,6 @@ jobs: # cat yaml_files.txt # xargs yamllint < yaml_files.txt # fi - - # - name: Get github app access token - # uses: actions/create-github-app-token@v1 - # id: get_access_token - # with: - # app-id: ${{ secrets.XERO_GITHUB_APP_ID }} - # private-key: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} - name: Install octokit dependencies run: npm i diff --git a/xero_files.yaml b/xero_files.yaml index 53346e9a7..3295f5a87 100644 --- a/xero_files.yaml +++ b/xero_files.yaml @@ -50,6 +50,16 @@ paths: - Size - CreatedDateUTC example: "CreatedDateUTC DESC" + - in: query + name: FileSize + description: values to sort by + schema: + type: string + enum: + - Name + - Size + - CreatedDateUTC + example: "100" responses: '200': description: search results matching criteria From fdacb25289bc104ad49f8a7d4beb4fd6cd3ca02d Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Fri, 20 Sep 2024 12:37:21 +0530 Subject: [PATCH 11/84] Added the workflow disptach code for node --- .github/workflows/pr.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 55604c21a..b498f0ac6 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -50,16 +50,12 @@ jobs: const token = await getAccessToken() return token - - name: Checkout codegen repo - uses: actions/checkout@v4 - with: - repository: xero-internal/xeroapi-sdk-codegen - path: xeroapi-sdk-codegen - token: ${{ steps.get_access_token.outputs.result }} - - - name: Checkout xero-node repo - uses: actions/checkout@v4 - with: - repository: XeroAPI/xero-node - path: xero-node - token: ${{steps.get_access_token.outputs.result}} \ No newline at end of file + - name: Calling node SDK workflow + run: | + curl --fail-with-body \ + -XPOST \ + -H 'Authorization: token ${{ steps.get_access_token.outputs.result }}' \ + -H "Accept: application/vnd.github.everest-preview+json" \ + -H "Content-Type: application/json" \ + https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/codegen-node-pr.yml/dispatches \ + -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name":"master"}}' \ No newline at end of file From f06dd8420e6fcf2012bce4a787d4431fa9430aed Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Fri, 20 Sep 2024 12:40:33 +0530 Subject: [PATCH 12/84] Added the bearer in the curl command --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b498f0ac6..41778e448 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -54,8 +54,8 @@ jobs: run: | curl --fail-with-body \ -XPOST \ - -H 'Authorization: token ${{ steps.get_access_token.outputs.result }}' \ + -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ - -H "Content-Type: application/json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/codegen-node-pr.yml/dispatches \ -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name":"master"}}' \ No newline at end of file From af884ee114a45287c4b0e218aa6015ad6f1e7e77 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Fri, 20 Sep 2024 12:48:28 +0530 Subject: [PATCH 13/84] testing workflow api --- .github/workflows/pr.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 41778e448..a8a0ebb7b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -50,9 +50,17 @@ jobs: const token = await getAccessToken() return token + - name: Fetching all workflows in codegen + run: | + curl -L \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ steps.get_access_token.outputs.result }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows + - name: Calling node SDK workflow run: | - curl --fail-with-body \ + curl -L \ -XPOST \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ From 6d3154aaa7157aae2c5be6c69501e74c170a53b9 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Fri, 20 Sep 2024 13:05:27 +0530 Subject: [PATCH 14/84] added permission to the workflow job --- .github/workflows/pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a8a0ebb7b..5025b7696 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -8,6 +8,9 @@ on: jobs: pr-health-check: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - name: Checkout Repository From 72abb4fddbba8af0f3ffbadfcb3b76729c48c329 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Fri, 20 Sep 2024 14:00:34 +0530 Subject: [PATCH 15/84] Added the PR branch name as input --- .github/workflows/pr.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5025b7696..ed71adde0 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -53,14 +53,6 @@ jobs: const token = await getAccessToken() return token - - name: Fetching all workflows in codegen - run: | - curl -L \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ steps.get_access_token.outputs.result }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows - - name: Calling node SDK workflow run: | curl -L \ @@ -69,4 +61,4 @@ jobs: -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/codegen-node-pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name":"master"}}' \ No newline at end of file + -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": ${{github.head_ref}}}}' \ No newline at end of file From dba10f4fbdb9c912e45449f58e35f19adf3a613d Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Fri, 20 Sep 2024 14:11:52 +0530 Subject: [PATCH 16/84] syntax corrected of the json payload for curl --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ed71adde0..dcac6da5b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,4 +61,4 @@ jobs: -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/codegen-node-pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": ${{github.head_ref}}}}' \ No newline at end of file + -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}' \ No newline at end of file From da4752a54d014450aa35607ae025004a6069a393 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Sat, 21 Sep 2024 10:43:59 +0530 Subject: [PATCH 17/84] Added all sdk workflow pr as dispatch call --- .github/workflows/pr.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index dcac6da5b..699bf7995 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -53,12 +53,13 @@ jobs: const token = await getAccessToken() return token - - name: Calling node SDK workflow + - name: Calling All SDK workflows run: | curl -L \ -XPOST \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/codegen-node-pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}' \ No newline at end of file + https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ + -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}' + \ No newline at end of file From c08ea3f64062c4b3b27e2577721ea334464d6bab Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 09:50:59 +0530 Subject: [PATCH 18/84] checking the response of the curl command --- .github/workflows/pr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 699bf7995..044f11f11 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -55,11 +55,12 @@ jobs: - name: Calling All SDK workflows run: | - curl -L \ + response=$(curl -L \ -XPOST \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}' + -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}') + echo "Triggered workflow with response: $response" \ No newline at end of file From 149be6309a58767c3d3bf12e76b180a0e6fb5f8f Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 09:53:05 +0530 Subject: [PATCH 19/84] corrected the curl --- .github/workflows/pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 044f11f11..957a5b55a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -55,12 +55,12 @@ jobs: - name: Calling All SDK workflows run: | - response=$(curl -L \ - -XPOST \ + response=$(curl -X POST \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}') - echo "Triggered workflow with response: $response" + echo "Triggered workflow with response:" + echo $response \ No newline at end of file From 786eaf25aa5b2bf680528e16a399a84180f0f2b6 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 10:12:01 +0530 Subject: [PATCH 20/84] fetching workflow run id --- .github/workflows/pr.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 957a5b55a..52d1b8dee 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -63,4 +63,20 @@ jobs: -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}') echo "Triggered workflow with response:" echo $response - \ No newline at end of file + + - name: Get workflow run ID + id: get-run-id + run: | + run_id=$(curl -s \ + -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ + -H "Accept: application/vnd.github.everest-preview+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/runs \ + | jq -r '.workflow_runs[] | select(.head_branch=="PETOSS-536-enabling-workflow-dispatch") | .id' | head -n 1) + + if [ -z "$run_id"]; then + echo "Failed to retrieve workflow run id" + exit 1 + else + echo "workflow run ID: $run_id" + fi \ No newline at end of file From 6d8bab99d9a20378d538c2e1772e278234631741 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 10:54:56 +0530 Subject: [PATCH 21/84] testing --- .github/workflows/pr.yml | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 52d1b8dee..6428b9af1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -55,28 +55,38 @@ jobs: - name: Calling All SDK workflows run: | - response=$(curl -X POST \ + curl -X POST \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}') - echo "Triggered workflow with response:" - echo $response + -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}' + + # - name: Get workflow run ID + # id: get-run-id + # run: | + # run_id=$(curl -s \ + # -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ + # -H "Accept: application/vnd.github.everest-preview+json" \ + # -H "X-GitHub-Api-Version: 2022-11-28" \ + # https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/runs \ + # | jq -r '.workflow_runs[0] | select(.head_branch=="PETOSS-536-enabling-workflow-dispatch") | .id' | head -n 1) + + # if [ -z "$run_id"]; then + # echo "Failed to retrieve workflow run id" + # exit 1 + # else + # echo "workflow run ID: $run_id" + # fi - name: Get workflow run ID id: get-run-id run: | - run_id=$(curl -s \ + workflow_run=$(curl -s \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/runs \ - | jq -r '.workflow_runs[] | select(.head_branch=="PETOSS-536-enabling-workflow-dispatch") | .id' | head -n 1) + https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/runs \ + | jq -r '.workflow_runs[0]') - if [ -z "$run_id"]; then - echo "Failed to retrieve workflow run id" - exit 1 - else - echo "workflow run ID: $run_id" - fi \ No newline at end of file + echo "workflow run: $workflow_run" From 27997f3a5506ff9e0c0b85f59b5e222b3c7142ca Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 12:15:22 +0530 Subject: [PATCH 22/84] testing response --- .github/workflows/pr.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6428b9af1..ad9659b2f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -55,12 +55,15 @@ jobs: - name: Calling All SDK workflows run: | - curl -X POST \ + response = $(curl -X POST \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}' + -w "%{http_code}") + + echo "response: $response" # - name: Get workflow run ID # id: get-run-id @@ -90,3 +93,7 @@ jobs: | jq -r '.workflow_runs[0]') echo "workflow run: $workflow_run" + + run_id=(echo $workflow_run | jq -r '.id') + + echo "workflow run ID: $run_id" From efff19e517165a6e8becf7f948891b67b1cd88f2 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 12:17:00 +0530 Subject: [PATCH 23/84] testing response object --- .github/workflows/pr.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ad9659b2f..2198c5835 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -55,13 +55,12 @@ jobs: - name: Calling All SDK workflows run: | - response = $(curl -X POST \ + response=$(curl -X POST \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}' - -w "%{http_code}") + -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}') echo "response: $response" From 59cc42c767c34678eb1f5d8dc86eeb2c8a7f3034 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 12:53:00 +0530 Subject: [PATCH 24/84] testing random number generator --- .github/workflows/pr.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2198c5835..2e9f4193c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -55,14 +55,14 @@ jobs: - name: Calling All SDK workflows run: | - response=$(curl -X POST \ - -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ - -H "Accept: application/vnd.github.everest-preview+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}"}}') - - echo "response: $response" + dispatchId=$(1000 + RANDOM % 90000) + echo "dispatchId: $dispatchId" + # curl -X POST \ + # -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ + # -H "Accept: application/vnd.github.everest-preview+json" \ + # -H "X-GitHub-Api-Version: 2022-11-28" \ + # https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ + # -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}", "dispatch_id": ""}}' # - name: Get workflow run ID # id: get-run-id From 0d5260f5008aec52554809e4f691b1cd622bd936 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 12:54:20 +0530 Subject: [PATCH 25/84] testing random number --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2e9f4193c..ea367d555 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -55,7 +55,7 @@ jobs: - name: Calling All SDK workflows run: | - dispatchId=$(1000 + RANDOM % 90000) + dispatchId=$((10000 + RANDOM % 90000)) echo "dispatchId: $dispatchId" # curl -X POST \ # -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ From 9ac0f4f0e29474d8a75987a7ee8a0f0114b62667 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 13:01:44 +0530 Subject: [PATCH 26/84] added the disptach id in the input params of the dispatch call. --- .github/workflows/pr.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ea367d555..a82e55dd4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -57,12 +57,12 @@ jobs: run: | dispatchId=$((10000 + RANDOM % 90000)) echo "dispatchId: $dispatchId" - # curl -X POST \ - # -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ - # -H "Accept: application/vnd.github.everest-preview+json" \ - # -H "X-GitHub-Api-Version: 2022-11-28" \ - # https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - # -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}", "dispatch_id": ""}}' + curl -X POST \ + -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ + -H "Accept: application/vnd.github.everest-preview+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ + -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}", "dispatch_id": "$dispatchId"}}' # - name: Get workflow run ID # id: get-run-id From e0bb83ac6a8674cc4b1f7c2eaa05d50a691a9ba9 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 13:03:02 +0530 Subject: [PATCH 27/84] corrected the dispatch call syntax --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a82e55dd4..f3fd77b4b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -62,7 +62,7 @@ jobs: -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}", "dispatch_id": "$dispatchId"}}' + -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}", "dispatch_id": $dispatchId}}' # - name: Get workflow run ID # id: get-run-id From d21b5aef56638909048025470181f03d58e2353f Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 13:16:02 +0530 Subject: [PATCH 28/84] refactored the json payload --- .github/workflows/pr.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f3fd77b4b..689877bd2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -57,12 +57,20 @@ jobs: run: | dispatchId=$((10000 + RANDOM % 90000)) echo "dispatchId: $dispatchId" + + json_payload=$(jq -n \ + --arg ref "PETOSS-536-enabling-workflow-dispatch" \ + --arg dispatch_id "$dispatchId" \ + --arg branch_name "${{github.head_ref}}" + '{ref: $ref, inputs: {dispatch_id: $dispatch_id, branch_name: $branch_name}}' + + ) curl -X POST \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}", "dispatch_id": $dispatchId}}' + -d "$json_payload" # - name: Get workflow run ID # id: get-run-id From 9e9f1243c818921bb4f7e3c77c6752ab755a8b1a Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 13:25:55 +0530 Subject: [PATCH 29/84] added wait for completion in step --- .github/workflows/pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 689877bd2..7ba68d28c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -62,7 +62,8 @@ jobs: --arg ref "PETOSS-536-enabling-workflow-dispatch" \ --arg dispatch_id "$dispatchId" \ --arg branch_name "${{github.head_ref}}" - '{ref: $ref, inputs: {dispatch_id: $dispatch_id, branch_name: $branch_name}}' + --arg wait-for-completion "true" + '{ref: $ref, inputs: {dispatch_id: $dispatch_id, branch_name: $branch_name, wait_for_completion: $wait-for-completion}}' ) curl -X POST \ From 4fe77b293e0de3e8aab84912e30f363c86fbbf66 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 13:26:17 +0530 Subject: [PATCH 30/84] corrected the syntax --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7ba68d28c..afba1846e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,8 +61,8 @@ jobs: json_payload=$(jq -n \ --arg ref "PETOSS-536-enabling-workflow-dispatch" \ --arg dispatch_id "$dispatchId" \ - --arg branch_name "${{github.head_ref}}" - --arg wait-for-completion "true" + --arg branch_name "${{github.head_ref}}" \ + --arg wait-for-completion "true" \ '{ref: $ref, inputs: {dispatch_id: $dispatch_id, branch_name: $branch_name, wait_for_completion: $wait-for-completion}}' ) From 2f6f7847651d079dd2bc929ef752fe4f07c87666 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 14:06:17 +0530 Subject: [PATCH 31/84] Added the public action for trigger flow --- .github/workflows/pr.yml | 73 ++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index afba1846e..4a0c19746 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -53,25 +53,40 @@ jobs: const token = await getAccessToken() return token - - name: Calling All SDK workflows - run: | - dispatchId=$((10000 + RANDOM % 90000)) - echo "dispatchId: $dispatchId" + - name: Trigger All SDK workflow + uses: convictional/trigger-workflow-and-wait@v1.6.1 + with: + owner: xero-internal + repo: xeroapi-sdk-codegen + github_token: ${{ steps.get_access_token.outputs.result }} + workflow_file_name: pr.yml + ref: PETOSS-536-enabling-workflow-dispatch + wait_interval: 10 + client_payload: '{"branch_name": "${{github.head_ref}}"}' + propagate_failure: false + trigger_workflow: true + wait_workflow: true + + + # - name: Calling All SDK workflows + # run: | + # dispatchId=$((10000 + RANDOM % 90000)) + # echo "dispatchId: $dispatchId" - json_payload=$(jq -n \ - --arg ref "PETOSS-536-enabling-workflow-dispatch" \ - --arg dispatch_id "$dispatchId" \ - --arg branch_name "${{github.head_ref}}" \ - --arg wait-for-completion "true" \ - '{ref: $ref, inputs: {dispatch_id: $dispatch_id, branch_name: $branch_name, wait_for_completion: $wait-for-completion}}' + # json_payload=$(jq -n \ + # --arg ref "PETOSS-536-enabling-workflow-dispatch" \ + # --arg dispatch_id "$dispatchId" \ + # --arg branch_name "${{github.head_ref}}" \ + # --arg wait-for-completion "true" \ + # '{ref: $ref, inputs: {dispatch_id: $dispatch_id, branch_name: $branch_name, wait_for_completion: $wait-for-completion}}' - ) - curl -X POST \ - -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ - -H "Accept: application/vnd.github.everest-preview+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - -d "$json_payload" + # ) + # curl -X POST \ + # -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ + # -H "Accept: application/vnd.github.everest-preview+json" \ + # -H "X-GitHub-Api-Version: 2022-11-28" \ + # https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ + # -d "$json_payload" # - name: Get workflow run ID # id: get-run-id @@ -90,18 +105,18 @@ jobs: # echo "workflow run ID: $run_id" # fi - - name: Get workflow run ID - id: get-run-id - run: | - workflow_run=$(curl -s \ - -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ - -H "Accept: application/vnd.github.everest-preview+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/runs \ - | jq -r '.workflow_runs[0]') + # - name: Get workflow run ID + # id: get-run-id + # run: | + # workflow_run=$(curl -s \ + # -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ + # -H "Accept: application/vnd.github.everest-preview+json" \ + # -H "X-GitHub-Api-Version: 2022-11-28" \ + # https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/runs \ + # | jq -r '.workflow_runs[0]') - echo "workflow run: $workflow_run" + # echo "workflow run: $workflow_run" - run_id=(echo $workflow_run | jq -r '.id') + # run_id=(echo $workflow_run | jq -r '.id') - echo "workflow run ID: $run_id" + # echo "workflow run ID: $run_id" From 2bef4312717bd6091c67edd554ef19913b1190bb Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 14:12:07 +0530 Subject: [PATCH 32/84] made propagate failure to true --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4a0c19746..8e6c6beda 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -63,7 +63,7 @@ jobs: ref: PETOSS-536-enabling-workflow-dispatch wait_interval: 10 client_payload: '{"branch_name": "${{github.head_ref}}"}' - propagate_failure: false + propagate_failure: true trigger_workflow: true wait_workflow: true From 6703efc4f65d0403b9de4a75c8d51cd5b58c6e31 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 10:17:28 +0530 Subject: [PATCH 33/84] clean up commented code --- .github/workflows/pr.yml | 57 ++-------------------------------------- 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8e6c6beda..bec357d4f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,62 +61,9 @@ jobs: github_token: ${{ steps.get_access_token.outputs.result }} workflow_file_name: pr.yml ref: PETOSS-536-enabling-workflow-dispatch - wait_interval: 10 + wait_interval: 30 client_payload: '{"branch_name": "${{github.head_ref}}"}' propagate_failure: true trigger_workflow: true wait_workflow: true - - - # - name: Calling All SDK workflows - # run: | - # dispatchId=$((10000 + RANDOM % 90000)) - # echo "dispatchId: $dispatchId" - - # json_payload=$(jq -n \ - # --arg ref "PETOSS-536-enabling-workflow-dispatch" \ - # --arg dispatch_id "$dispatchId" \ - # --arg branch_name "${{github.head_ref}}" \ - # --arg wait-for-completion "true" \ - # '{ref: $ref, inputs: {dispatch_id: $dispatch_id, branch_name: $branch_name, wait_for_completion: $wait-for-completion}}' - - # ) - # curl -X POST \ - # -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ - # -H "Accept: application/vnd.github.everest-preview+json" \ - # -H "X-GitHub-Api-Version: 2022-11-28" \ - # https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - # -d "$json_payload" - - # - name: Get workflow run ID - # id: get-run-id - # run: | - # run_id=$(curl -s \ - # -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ - # -H "Accept: application/vnd.github.everest-preview+json" \ - # -H "X-GitHub-Api-Version: 2022-11-28" \ - # https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/runs \ - # | jq -r '.workflow_runs[0] | select(.head_branch=="PETOSS-536-enabling-workflow-dispatch") | .id' | head -n 1) - - # if [ -z "$run_id"]; then - # echo "Failed to retrieve workflow run id" - # exit 1 - # else - # echo "workflow run ID: $run_id" - # fi - - # - name: Get workflow run ID - # id: get-run-id - # run: | - # workflow_run=$(curl -s \ - # -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ - # -H "Accept: application/vnd.github.everest-preview+json" \ - # -H "X-GitHub-Api-Version: 2022-11-28" \ - # https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/runs \ - # | jq -r '.workflow_runs[0]') - - # echo "workflow run: $workflow_run" - - # run_id=(echo $workflow_run | jq -r '.id') - - # echo "workflow run ID: $run_id" + From d3053dc586fd0a25a579c8fb7c750cb78057c99d Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 10:29:59 +0530 Subject: [PATCH 34/84] Changed the ref to master in step --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index bec357d4f..9e3b54c44 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -60,7 +60,7 @@ jobs: repo: xeroapi-sdk-codegen github_token: ${{ steps.get_access_token.outputs.result }} workflow_file_name: pr.yml - ref: PETOSS-536-enabling-workflow-dispatch + ref: master wait_interval: 30 client_payload: '{"branch_name": "${{github.head_ref}}"}' propagate_failure: true From d8c5794fd362631f0b07bb478489cca7f16434e8 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 10:34:11 +0530 Subject: [PATCH 35/84] changed wait interval to 50 --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9e3b54c44..4834aee91 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,7 +61,7 @@ jobs: github_token: ${{ steps.get_access_token.outputs.result }} workflow_file_name: pr.yml ref: master - wait_interval: 30 + wait_interval: 50 client_payload: '{"branch_name": "${{github.head_ref}}"}' propagate_failure: true trigger_workflow: true From 7c0229bb54628f2139de5148e51254c2d76af86b Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 11:00:23 +0530 Subject: [PATCH 36/84] un commented yamllint step --- .github/workflows/pr.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4834aee91..2d9fb9c21 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -24,17 +24,17 @@ jobs: - name: Install yaml lint run: pip install yamllint - # - name: Run yamllint - # run: | - # git fetch > /dev/null 2>&1 - # git checkout ${{github.head_ref}} - # find . -type f \( -name "*.yaml" \) > yaml_files.txt + - name: Run yamllint + run: | + git fetch > /dev/null 2>&1 + git checkout ${{github.head_ref}} + find . -type f \( -name "*.yaml" \) > yaml_files.txt - # if [ -s yaml_files.txt ]; then - # echo "linting the following yaml files:" - # cat yaml_files.txt - # xargs yamllint < yaml_files.txt - # fi + if [ -s yaml_files.txt ]; then + echo "linting the following yaml files:" + cat yaml_files.txt + xargs yamllint < yaml_files.txt + fi - name: Install octokit dependencies run: npm i From c600051a9043b6be406f5a453acaf5d7a7fdb644 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 11:58:10 +0530 Subject: [PATCH 37/84] Addec the new xero approved action --- .github/workflows/pr.yml | 63 ++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2d9fb9c21..a14c3c132 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -24,17 +24,17 @@ jobs: - name: Install yaml lint run: pip install yamllint - - name: Run yamllint - run: | - git fetch > /dev/null 2>&1 - git checkout ${{github.head_ref}} - find . -type f \( -name "*.yaml" \) > yaml_files.txt + # - name: Run yamllint + # run: | + # git fetch > /dev/null 2>&1 + # git checkout ${{github.head_ref}} + # find . -type f \( -name "*.yaml" \) > yaml_files.txt - if [ -s yaml_files.txt ]; then - echo "linting the following yaml files:" - cat yaml_files.txt - xargs yamllint < yaml_files.txt - fi + # if [ -s yaml_files.txt ]; then + # echo "linting the following yaml files:" + # cat yaml_files.txt + # xargs yamllint < yaml_files.txt + # fi - name: Install octokit dependencies run: npm i @@ -53,17 +53,38 @@ jobs: const token = await getAccessToken() return token - - name: Trigger All SDK workflow - uses: convictional/trigger-workflow-and-wait@v1.6.1 - with: - owner: xero-internal + - name: Dispatch an action and get the run ID + uses: codex-/return-dispatch@v1 + id: return_dispatch + with: + token: ${{ steps.get_access_token.outputs.result }} repo: xeroapi-sdk-codegen - github_token: ${{ steps.get_access_token.outputs.result }} - workflow_file_name: pr.yml + owner: xero-internal + workflow: pr.yml ref: master - wait_interval: 50 - client_payload: '{"branch_name": "${{github.head_ref}}"}' - propagate_failure: true - trigger_workflow: true - wait_workflow: true + workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' + + - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} + uses: Codex-/await-remote-run@v1.0.0 + with: + token: ${{ steps.get_access_token.outputs.result }} + repo: return-dispatch + owner: codex- + run_id: ${{ steps.return_dispatch.outputs.run_id }} + run_timeout_seconds: 300 # Optional + poll_interval_ms: 5000 # Optional + + # - name: Trigger All SDK workflow + # uses: convictional/trigger-workflow-and-wait@v1.6.1 + # with: + # owner: xero-internal + # repo: xeroapi-sdk-codegen + # github_token: ${{ steps.get_access_token.outputs.result }} + # workflow_file_name: pr.yml + # ref: master + # wait_interval: 50 + # client_payload: '{"branch_name": "${{github.head_ref}}"}' + # propagate_failure: true + # trigger_workflow: true + # wait_workflow: true From 6454cfd6c756efcec50385d6fe56206ecd732426 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 12:00:27 +0530 Subject: [PATCH 38/84] updated the version number of the action --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a14c3c132..19e006e56 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -54,7 +54,7 @@ jobs: return token - name: Dispatch an action and get the run ID - uses: codex-/return-dispatch@v1 + uses: codex-/return-dispatch@v1.15.0 id: return_dispatch with: token: ${{ steps.get_access_token.outputs.result }} @@ -65,7 +65,7 @@ jobs: workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} - uses: Codex-/await-remote-run@v1.0.0 + uses: Codex-/await-remote-run@v1.12.2 with: token: ${{ steps.get_access_token.outputs.result }} repo: return-dispatch From 22631d2c51b3d7646ca405519472c7254087f787 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 12:04:26 +0530 Subject: [PATCH 39/84] added distinct id --- .github/workflows/pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 19e006e56..b9220059b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -53,7 +53,7 @@ jobs: const token = await getAccessToken() return token - - name: Dispatch an action and get the run ID + - name: Trigger all SDK workflow uses: codex-/return-dispatch@v1.15.0 id: return_dispatch with: @@ -63,6 +63,7 @@ jobs: workflow: pr.yml ref: master workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' + distinct_id: 1378719879 - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} uses: Codex-/await-remote-run@v1.12.2 From 78ca8e21ba5afaf4649d2127864f12d328a15848 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 12:11:36 +0530 Subject: [PATCH 40/84] updated the ref --- .github/workflows/pr.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b9220059b..da23d6f41 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,14 +61,13 @@ jobs: repo: xeroapi-sdk-codegen owner: xero-internal workflow: pr.yml - ref: master + ref: PETOSS-536-workflow-dispatch-update workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' - distinct_id: 1378719879 - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} uses: Codex-/await-remote-run@v1.12.2 with: - token: ${{ steps.get_access_token.outputs.result }} + token: ${{ github.token }} repo: return-dispatch owner: codex- run_id: ${{ steps.return_dispatch.outputs.run_id }} From cd149adb4d9ca0902bdc0aea43927ead1a3ddc97 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 12:18:59 +0530 Subject: [PATCH 41/84] timeout increased for the trigger step --- .github/workflows/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index da23d6f41..2154b4233 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -63,6 +63,7 @@ jobs: workflow: pr.yml ref: PETOSS-536-workflow-dispatch-update workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' + workflow_timeout_seconds: 700 - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} uses: Codex-/await-remote-run@v1.12.2 From d3e6d5516be09dd38e91815758bea0e5bfbca868 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 12:24:51 +0530 Subject: [PATCH 42/84] increased the time --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2154b4233..71d271a3f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -72,7 +72,7 @@ jobs: repo: return-dispatch owner: codex- run_id: ${{ steps.return_dispatch.outputs.run_id }} - run_timeout_seconds: 300 # Optional + run_timeout_seconds: 700 # Optional poll_interval_ms: 5000 # Optional # - name: Trigger All SDK workflow From 5f96bc41d65b60e05d85bf5a604965b6c86c33e8 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 12:34:25 +0530 Subject: [PATCH 43/84] corrected the step details --- .github/workflows/pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 71d271a3f..083e90f9a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -68,9 +68,9 @@ jobs: - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} uses: Codex-/await-remote-run@v1.12.2 with: - token: ${{ github.token }} - repo: return-dispatch - owner: codex- + token: ${{ steps.get_access_token.outputs.result }} + repo: xeroapi-sdk-codegen + owner: xero-internal run_id: ${{ steps.return_dispatch.outputs.run_id }} run_timeout_seconds: 700 # Optional poll_interval_ms: 5000 # Optional From bb3b68b0264e01b8367ba61838afd0c72223248e Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 12:53:34 +0530 Subject: [PATCH 44/84] adjusted the time --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 083e90f9a..526340285 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -63,7 +63,7 @@ jobs: workflow: pr.yml ref: PETOSS-536-workflow-dispatch-update workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' - workflow_timeout_seconds: 700 + workflow_timeout_seconds: 600 - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} uses: Codex-/await-remote-run@v1.12.2 From dd87dd170a19a3a1fe719e73bf82d12c0baa283c Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 13:10:46 +0530 Subject: [PATCH 45/84] Added the time as string --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 526340285..17712f1b8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -63,7 +63,7 @@ jobs: workflow: pr.yml ref: PETOSS-536-workflow-dispatch-update workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' - workflow_timeout_seconds: 600 + workflow_timeout_seconds: "600" - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} uses: Codex-/await-remote-run@v1.12.2 From da05a1d49739d02438d31a1c69486ddd79e4ab2d Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 13:47:12 +0530 Subject: [PATCH 46/84] used the beta version of the trigger action --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 17712f1b8..8bd5f7f72 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -54,7 +54,7 @@ jobs: return token - name: Trigger all SDK workflow - uses: codex-/return-dispatch@v1.15.0 + uses: codex-/return-dispatch@feat/improve_retry_strategy id: return_dispatch with: token: ${{ steps.get_access_token.outputs.result }} @@ -63,7 +63,7 @@ jobs: workflow: pr.yml ref: PETOSS-536-workflow-dispatch-update workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' - workflow_timeout_seconds: "600" + workflow_timeout_seconds: 600 - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} uses: Codex-/await-remote-run@v1.12.2 From 1dad7c306407aa564565945c8a37421d70e830ca Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 15:34:15 +0530 Subject: [PATCH 47/84] corrected the return dispatch version --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8bd5f7f72..0f529638f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -54,7 +54,7 @@ jobs: return token - name: Trigger all SDK workflow - uses: codex-/return-dispatch@feat/improve_retry_strategy + uses: codex-/return-dispatch@v1 id: return_dispatch with: token: ${{ steps.get_access_token.outputs.result }} From 3e8bab91d3754d51144bc185157d831b81510fcc Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 16:03:28 +0530 Subject: [PATCH 48/84] master branch is referenced --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0f529638f..5dce2cd3c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,7 +61,7 @@ jobs: repo: xeroapi-sdk-codegen owner: xero-internal workflow: pr.yml - ref: PETOSS-536-workflow-dispatch-update + ref: master workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' workflow_timeout_seconds: 600 From becdadba35a4fc3dad90837062eeeadedf662c7c Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 17:00:19 +0530 Subject: [PATCH 49/84] corrected the ref --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5dce2cd3c..6f0a570b2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,7 +61,7 @@ jobs: repo: xeroapi-sdk-codegen owner: xero-internal workflow: pr.yml - ref: master + ref: refs/heads/master workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' workflow_timeout_seconds: 600 From 5454ca69771d4f282d16beb09d572f314dae91c4 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Tue, 24 Sep 2024 17:03:26 +0530 Subject: [PATCH 50/84] used the time in string --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6f0a570b2..8381ae03a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -63,7 +63,7 @@ jobs: workflow: pr.yml ref: refs/heads/master workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' - workflow_timeout_seconds: 600 + workflow_timeout_seconds: "600" - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} uses: Codex-/await-remote-run@v1.12.2 From da826df45dbb426a10be099dbd917ca9e84b5826 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Wed, 25 Sep 2024 11:15:47 +0530 Subject: [PATCH 51/84] permission --- .github/workflows/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8381ae03a..468c94973 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,6 +11,7 @@ jobs: permissions: contents: write pull-requests: write + actions: read steps: - name: Checkout Repository From 3ec29b295c617fe4c60750073daac82f8fc1797d Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Wed, 25 Sep 2024 15:39:24 +0530 Subject: [PATCH 52/84] Added the feature branch for testing --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 468c94973..7cd55a76d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -62,7 +62,7 @@ jobs: repo: xeroapi-sdk-codegen owner: xero-internal workflow: pr.yml - ref: refs/heads/master + ref: refs/heads/PETOSS-536-Action-Dispatch-permission workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' workflow_timeout_seconds: "600" From 03533f9cdb092631d2e4315be3df9254147b4daf Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Wed, 25 Sep 2024 16:51:28 +0530 Subject: [PATCH 53/84] Added conditional step for merge flow --- .github/workflows/pr.yml | 45 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7cd55a76d..0f5685ea7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -54,27 +54,27 @@ jobs: const token = await getAccessToken() return token - - name: Trigger all SDK workflow - uses: codex-/return-dispatch@v1 - id: return_dispatch - with: - token: ${{ steps.get_access_token.outputs.result }} - repo: xeroapi-sdk-codegen - owner: xero-internal - workflow: pr.yml - ref: refs/heads/PETOSS-536-Action-Dispatch-permission - workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' - workflow_timeout_seconds: "600" + # - name: Trigger all SDK workflow + # uses: codex-/return-dispatch@v1 + # id: return_dispatch + # with: + # token: ${{ steps.get_access_token.outputs.result }} + # repo: xeroapi-sdk-codegen + # owner: xero-internal + # workflow: pr.yml + # ref: refs/heads/PETOSS-536-Action-Dispatch-permission + # workflow_inputs: '{"branch_name": "${{github.head_ref}}"}' + # workflow_timeout_seconds: "600" - - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} - uses: Codex-/await-remote-run@v1.12.2 - with: - token: ${{ steps.get_access_token.outputs.result }} - repo: xeroapi-sdk-codegen - owner: xero-internal - run_id: ${{ steps.return_dispatch.outputs.run_id }} - run_timeout_seconds: 700 # Optional - poll_interval_ms: 5000 # Optional + # - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }} + # uses: Codex-/await-remote-run@v1.12.2 + # with: + # token: ${{ steps.get_access_token.outputs.result }} + # repo: xeroapi-sdk-codegen + # owner: xero-internal + # run_id: ${{ steps.return_dispatch.outputs.run_id }} + # run_timeout_seconds: 700 # Optional + # poll_interval_ms: 5000 # Optional # - name: Trigger All SDK workflow # uses: convictional/trigger-workflow-and-wait@v1.6.1 @@ -89,4 +89,9 @@ jobs: # propagate_failure: true # trigger_workflow: true # wait_workflow: true + + - name: Raise Open API version update PR + if: ${{github.event_name == 'push' }} + run: | + echo "runnning joy ********" From 4641aaaeddfd76ef06447edabfb6e602ee12bf46 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 00:29:44 +0530 Subject: [PATCH 54/84] Added yq --- .github/workflows/pr.yml | 5 ----- .github/workflows/update-yaml-version.yml | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/update-yaml-version.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0f5685ea7..24bbfaae0 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -89,9 +89,4 @@ jobs: # propagate_failure: true # trigger_workflow: true # wait_workflow: true - - - name: Raise Open API version update PR - if: ${{github.event_name == 'push' }} - run: | - echo "runnning joy ********" diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml new file mode 100644 index 000000000..9420c7711 --- /dev/null +++ b/.github/workflows/update-yaml-version.yml @@ -0,0 +1,21 @@ +name: Update YAML version and raise PR + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + Update-OpenAPI-version: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Install yq + run: sudo apt-get install -y yq + From 1afb395cb669f0fd5e599b0bea400d97e8fde098 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 00:36:00 +0530 Subject: [PATCH 55/84] Added pr trigger condition --- .github/workflows/update-yaml-version.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 9420c7711..c55f5b585 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -1,12 +1,18 @@ name: Update YAML version and raise PR on: - release: - types: [published] - workflow_dispatch: + release: + types: [published] + + workflow_dispatch: + + pull_request: + paths: + - '**' + jobs: - Update-OpenAPI-version: + Update-yaml-version: runs-on: ubuntu-latest permissions: contents: write @@ -15,7 +21,7 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - + - name: Install yq run: sudo apt-get install -y yq From 3c6b8dd0d8e1062f178dfb938b9bf31f903f5d8e Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 00:39:20 +0530 Subject: [PATCH 56/84] checking yq version --- .github/workflows/update-yaml-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index c55f5b585..5ded7c628 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -23,5 +23,5 @@ jobs: uses: actions/checkout@v4 - name: Install yq - run: sudo apt-get install -y yq + run: yq --version From be589baef867a72b0460ac97bca19cdc69b8f3a4 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 00:47:32 +0530 Subject: [PATCH 57/84] using yq --- .github/workflows/update-yaml-version.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 5ded7c628..7a2a5899e 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -22,6 +22,11 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Install yq - run: yq --version + - name: Update version of the yaml files + run: | + Files=("xero_accounting.yaml", "xero_assets.yaml", "xero_bankfeeds.yaml", "xero_files.yaml", "xero-app-store.yaml") + for file in "${Files[@]}"; do + yq eval ".info.version = 10.1.0" -i "$file" + echo "updated version in $file" + done From d8ba71c6d0ccbe37ce4287bdc54fd5665001115d Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 10:04:22 +0530 Subject: [PATCH 58/84] logging & testing --- .github/workflows/update-yaml-version.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 7a2a5899e..9a5296f2a 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -24,6 +24,7 @@ jobs: - name: Update version of the yaml files run: | + ls Files=("xero_accounting.yaml", "xero_assets.yaml", "xero_bankfeeds.yaml", "xero_files.yaml", "xero-app-store.yaml") for file in "${Files[@]}"; do yq eval ".info.version = 10.1.0" -i "$file" From 724be0889be1a0629463165142e915cc3e4ac0e9 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 10:09:12 +0530 Subject: [PATCH 59/84] testing yq --- .github/workflows/update-yaml-version.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 9a5296f2a..038e1f23a 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -25,9 +25,9 @@ jobs: - name: Update version of the yaml files run: | ls - Files=("xero_accounting.yaml", "xero_assets.yaml", "xero_bankfeeds.yaml", "xero_files.yaml", "xero-app-store.yaml") + Files=("./xero_accounting.yaml", "./xero_assets.yaml", "./xero_bankfeeds.yaml", "./xero_files.yaml", "./xero-app-store.yaml") for file in "${Files[@]}"; do - yq eval ".info.version = 10.1.0" -i "$file" + yq eval ".info.version = \"10.1.0\"" -i "$file" echo "updated version in $file" done From 7ca695707cd85882d1f6b35e9f90a0929f755fbb Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 10:11:58 +0530 Subject: [PATCH 60/84] testing --- .github/workflows/update-yaml-version.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 038e1f23a..610d60d4e 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -10,6 +10,7 @@ on: paths: - '**' + # Files=("./xero_accounting.yaml", "./xero_assets.yaml", "./xero_bankfeeds.yaml", "./xero_files.yaml", "./xero-app-store.yaml") jobs: Update-yaml-version: @@ -25,8 +26,7 @@ jobs: - name: Update version of the yaml files run: | ls - Files=("./xero_accounting.yaml", "./xero_assets.yaml", "./xero_bankfeeds.yaml", "./xero_files.yaml", "./xero-app-store.yaml") - for file in "${Files[@]}"; do + for file in xero_accounting.yaml xero_assets.yaml; do yq eval ".info.version = \"10.1.0\"" -i "$file" echo "updated version in $file" done From 9039e841dbb30494925977d9da2d7b1c3001f0c0 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 10:15:10 +0530 Subject: [PATCH 61/84] Added all the yamls --- .github/workflows/update-yaml-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 610d60d4e..10bdfbe2a 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -26,7 +26,7 @@ jobs: - name: Update version of the yaml files run: | ls - for file in xero_accounting.yaml xero_assets.yaml; do + for file in xero_accounting.yaml xero_assets.yaml xero_bankfeeds.yaml xero_files.yaml xero-app-store.yaml xero-finance.yaml xero-identity.yaml xero-payroll-au.yaml xero-payroll-nz.yaml xero-payroll-uk.yaml xero-projects.yaml; do yq eval ".info.version = \"10.1.0\"" -i "$file" echo "updated version in $file" done From e6bac9e3c16d7b7bc60a76cf083fbfd1c3620f25 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 10:17:10 +0530 Subject: [PATCH 62/84] printing the yaml --- .github/workflows/update-yaml-version.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 10bdfbe2a..2a299b924 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -10,8 +10,6 @@ on: paths: - '**' - # Files=("./xero_accounting.yaml", "./xero_assets.yaml", "./xero_bankfeeds.yaml", "./xero_files.yaml", "./xero-app-store.yaml") - jobs: Update-yaml-version: runs-on: ubuntu-latest @@ -30,4 +28,5 @@ jobs: yq eval ".info.version = \"10.1.0\"" -i "$file" echo "updated version in $file" done + head -n 20 xero_assets.yaml From cd10a84ab30d3092b4da2f866eb626974985517f Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 10:30:55 +0530 Subject: [PATCH 63/84] Added the PR raise steps --- .github/workflows/update-yaml-version.yml | 68 ++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 2a299b924..789eae2f5 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -29,4 +29,70 @@ jobs: echo "updated version in $file" done head -n 20 xero_assets.yaml - + + - name: Checking existing PR + shell: bash + id: check-pr + run: | + BRANCH_NAME='OAS-version-update-10.1.0' + TARGET_BRANCH='master' + PR_EXISTS=$(gh pr list --head "$BRANCH_NAME" --base "$TARGET_BRANCH" --json number --jq '. | length') + + if [ "$PR_EXISTS" -gt 0 ]; then + echo "PR already exists" + echo "pr_exists=true" >> $GITHUB_OUTPUT + else + echo "No PR exists" + echo "pr_exists=false" >> $GITHUB_OUTPUT + fi + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Staging & commiting + id: detect-changes + shell: bash + run: | + CHANGES_DETECTED=$(git diff) + if [ -z "$CHANGES_DETECTED" ]; then + echo "no new changes, nothing to commit" + echo "changes_detected=false" >> $GITHUB_OUTPUT + else + echo "changes_detected=true" >> $GITHUB_OUTPUT + echo "running the git commands......" + + echo 'staging the changes' + git add --all + + echo 'git status' + git diff + + echo "git config setup" + git config --global user.name "Github Actions" + git config --global user.email "actions@github.com" + + echo 'commiting changes....' + git commit -m "chore: version update for all the yaml files" + fi + + - name: Pushing the Branch + shell: bash + run: | + if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + echo "pushing the code to OAS-version-update-10.1.0" + git push origin OAS-version-update-10.1.0 + fi + + - name: Create PR + shell: bash + run: | + if [ "${{steps.check-pr.outputs.pr_exists}}" == "false" ] && [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + echo "Creating PR in OAS-version-update-10.1.0" + gh pr create \ + --title "OAS version update" \ + --base master \ + --head OAS-version-update-10.1.0 \ + EOF + )" + fi + env: + GITHUB_TOKEN: ${{ github.token }} From 1ed1ae7c7e00d1e1d244fa69fd38ecfb43ce57d8 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 10:47:12 +0530 Subject: [PATCH 64/84] checkout codegen repo --- .github/workflows/update-yaml-version.yml | 157 ++++++++++++++-------- 1 file changed, 100 insertions(+), 57 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 789eae2f5..af0f61a9f 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -30,69 +30,112 @@ jobs: done head -n 20 xero_assets.yaml - - name: Checking existing PR - shell: bash - id: check-pr - run: | - BRANCH_NAME='OAS-version-update-10.1.0' - TARGET_BRANCH='master' - PR_EXISTS=$(gh pr list --head "$BRANCH_NAME" --base "$TARGET_BRANCH" --json number --jq '. | length') - - if [ "$PR_EXISTS" -gt 0 ]; then - echo "PR already exists" - echo "pr_exists=true" >> $GITHUB_OUTPUT - else - echo "No PR exists" - echo "pr_exists=false" >> $GITHUB_OUTPUT - fi + + - name: Install octokit dependencies + run: npm i + working-directory: ${{ github.workspace }}/.github/octokit + + - name: Get github app access token + id: get_access_token env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_APP_ID: ${{ secrets.XERO_GITHUB_APP_ID }} + GITHUB_APP_PRIVATE_KEY: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} + uses: actions/github-script@v7 + with: + result-encoding: string + script: | + const { getAccessToken } = await import('${{ github.workspace }}/.github/octokit/index.js') + const token = await getAccessToken() + return token + - - name: Staging & commiting - id: detect-changes - shell: bash + - name: Checkout codegen repo + uses: actions/checkout@v4 + with: + repository: xero-internal/xeroapi-sdk-codegen + token: ${{steps.get_access_token.outputs.result}} + + - name: checking current dir run: | - CHANGES_DETECTED=$(git diff) - if [ -z "$CHANGES_DETECTED" ]; then - echo "no new changes, nothing to commit" - echo "changes_detected=false" >> $GITHUB_OUTPUT - else - echo "changes_detected=true" >> $GITHUB_OUTPUT - echo "running the git commands......" + ls + + # - name: Checking existing PR + # shell: bash + # id: check-pr + # run: | + # BRANCH_NAME='OAS-version-update-10.1.0' + # TARGET_BRANCH='master' + # PR_EXISTS=$(gh pr list --head "$BRANCH_NAME" --base "$TARGET_BRANCH" --json number --jq '. | length') + + # if [ "$PR_EXISTS" -gt 0 ]; then + # echo "PR already exists" + # echo "pr_exists=true" >> $GITHUB_OUTPUT + # else + # echo "No PR exists" + # echo "pr_exists=false" >> $GITHUB_OUTPUT + # fi + # env: + # GITHUB_TOKEN: ${{ github.token }} + + # - name: Checkout branch + # working-directory: xero-ruby + # run: | + # if [ "${{github.event_name}}" == "push" ]; then + # if git ls-remote --heads origin ${{steps.identify_branch_name.outputs.branchName}} | grep -q "refs/heads/${{steps.identify_branch_name.outputs.branchName}}"; then + # echo "checking out existing branch" + # git fetch origin > /dev/null 2>&1 + # git checkout ${{steps.identify_branch_name.outputs.branchName}} + # else + # echo "branch does not exists, creating new branch" + # git checkout -b ${{steps.identify_branch_name.outputs.branchName}} + # fi + # fi + + # - name: Staging & commiting + # id: detect-changes + # shell: bash + # run: | + # CHANGES_DETECTED=$(git diff) + # if [ -z "$CHANGES_DETECTED" ]; then + # echo "no new changes, nothing to commit" + # echo "changes_detected=false" >> $GITHUB_OUTPUT + # else + # echo "changes_detected=true" >> $GITHUB_OUTPUT + # echo "running the git commands......" - echo 'staging the changes' - git add --all + # echo 'staging the changes' + # git add --all - echo 'git status' - git diff + # echo 'git status' + # git diff - echo "git config setup" - git config --global user.name "Github Actions" - git config --global user.email "actions@github.com" + # echo "git config setup" + # git config --global user.name "Github Actions" + # git config --global user.email "actions@github.com" - echo 'commiting changes....' - git commit -m "chore: version update for all the yaml files" - fi + # echo 'commiting changes....' + # git commit -m "chore: version update for all the yaml files" + # fi - - name: Pushing the Branch - shell: bash - run: | - if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - echo "pushing the code to OAS-version-update-10.1.0" - git push origin OAS-version-update-10.1.0 - fi + # - name: Pushing the Branch + # shell: bash + # run: | + # if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + # echo "pushing the code to OAS-version-update-10.1.0" + # git push origin OAS-version-update-10.1.0 + # fi - - name: Create PR - shell: bash - run: | - if [ "${{steps.check-pr.outputs.pr_exists}}" == "false" ] && [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - echo "Creating PR in OAS-version-update-10.1.0" - gh pr create \ - --title "OAS version update" \ - --base master \ - --head OAS-version-update-10.1.0 \ - EOF - )" - fi - env: - GITHUB_TOKEN: ${{ github.token }} + # - name: Create PR + # shell: bash + # run: | + # if [ "${{steps.check-pr.outputs.pr_exists}}" == "false" ] && [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + # echo "Creating PR in OAS-version-update-10.1.0" + # gh pr create \ + # --title "OAS version update" \ + # --base master \ + # --head OAS-version-update-10.1.0 \ + # EOF + # )" + # fi + # env: + # GITHUB_TOKEN: ${{ github.token }} From 5796ceb97f95e972fc086d3844f50cd03d7d32bc Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 10:49:38 +0530 Subject: [PATCH 65/84] added path to checkout --- .github/workflows/update-yaml-version.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index af0f61a9f..8b0891ff9 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -53,6 +53,7 @@ jobs: uses: actions/checkout@v4 with: repository: xero-internal/xeroapi-sdk-codegen + path: xeroapi-sdk-codegen token: ${{steps.get_access_token.outputs.result}} - name: checking current dir From f2c46c474276ae03cd1ae75becc9f013fda05165 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 12:54:19 +0530 Subject: [PATCH 66/84] updated the version update workflow --- .github/workflows/update-yaml-version.yml | 159 ++++++++-------------- 1 file changed, 59 insertions(+), 100 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 8b0891ff9..3fa85b032 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -31,112 +31,71 @@ jobs: head -n 20 xero_assets.yaml - - name: Install octokit dependencies - run: npm i - working-directory: ${{ github.workspace }}/.github/octokit - - - name: Get github app access token - id: get_access_token - env: - GITHUB_APP_ID: ${{ secrets.XERO_GITHUB_APP_ID }} - GITHUB_APP_PRIVATE_KEY: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getAccessToken } = await import('${{ github.workspace }}/.github/octokit/index.js') - const token = await getAccessToken() - return token - - - - name: Checkout codegen repo - uses: actions/checkout@v4 - with: - repository: xero-internal/xeroapi-sdk-codegen - path: xeroapi-sdk-codegen - token: ${{steps.get_access_token.outputs.result}} - - - name: checking current dir + - name: Identify the branch name + id: identify_branch_name + working-directory: xeroapi-sdk-codegen/ruby/scripts run: | - ls + branch_name='OAS-version-update-10.3.7' + echo "branchName=$branch_name" >> $GITHUB_OUTPUT - # - name: Checking existing PR - # shell: bash - # id: check-pr - # run: | - # BRANCH_NAME='OAS-version-update-10.1.0' - # TARGET_BRANCH='master' - # PR_EXISTS=$(gh pr list --head "$BRANCH_NAME" --base "$TARGET_BRANCH" --json number --jq '. | length') - - # if [ "$PR_EXISTS" -gt 0 ]; then - # echo "PR already exists" - # echo "pr_exists=true" >> $GITHUB_OUTPUT - # else - # echo "No PR exists" - # echo "pr_exists=false" >> $GITHUB_OUTPUT - # fi - # env: - # GITHUB_TOKEN: ${{ github.token }} - - # - name: Checkout branch - # working-directory: xero-ruby - # run: | - # if [ "${{github.event_name}}" == "push" ]; then - # if git ls-remote --heads origin ${{steps.identify_branch_name.outputs.branchName}} | grep -q "refs/heads/${{steps.identify_branch_name.outputs.branchName}}"; then - # echo "checking out existing branch" - # git fetch origin > /dev/null 2>&1 - # git checkout ${{steps.identify_branch_name.outputs.branchName}} - # else - # echo "branch does not exists, creating new branch" - # git checkout -b ${{steps.identify_branch_name.outputs.branchName}} - # fi - # fi + - name: Checkout branch + run: | + if [ "${{github.event_name}}" == "push" ]; then + if git ls-remote --heads origin ${{steps.identify_branch_name.outputs.branchName}} | grep -q "refs/heads/${{steps.identify_branch_name.outputs.branchName}}"; then + echo "checking out existing branch" + git fetch origin > /dev/null 2>&1 + git checkout ${{steps.identify_branch_name.outputs.branchName}} + else + echo "branch does not exists, creating new branch" + git checkout -b ${{steps.identify_branch_name.outputs.branchName}} + fi + fi - # - name: Staging & commiting - # id: detect-changes - # shell: bash - # run: | - # CHANGES_DETECTED=$(git diff) - # if [ -z "$CHANGES_DETECTED" ]; then - # echo "no new changes, nothing to commit" - # echo "changes_detected=false" >> $GITHUB_OUTPUT - # else - # echo "changes_detected=true" >> $GITHUB_OUTPUT - # echo "running the git commands......" + - name: Staging & commiting + id: detect-changes + shell: bash + run: | + CHANGES_DETECTED=$(git diff) + if [ -z "$CHANGES_DETECTED" ]; then + echo "no new changes, nothing to commit" + echo "changes_detected=false" >> $GITHUB_OUTPUT + else + echo "changes_detected=true" >> $GITHUB_OUTPUT + echo "running the git commands......" - # echo 'staging the changes' - # git add --all + echo 'staging the changes' + git add --all - # echo 'git status' - # git diff + echo 'git status' + git diff - # echo "git config setup" - # git config --global user.name "Github Actions" - # git config --global user.email "actions@github.com" + echo "git config setup" + git config --global user.name "Github Actions" + git config --global user.email "actions@github.com" - # echo 'commiting changes....' - # git commit -m "chore: version update for all the yaml files" - # fi + echo 'commiting changes....' + git commit -m "chore: version update for all the yaml files" + fi - # - name: Pushing the Branch - # shell: bash - # run: | - # if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - # echo "pushing the code to OAS-version-update-10.1.0" - # git push origin OAS-version-update-10.1.0 - # fi + - name: Pushing the Branch + shell: bash + run: | + if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + echo "pushing the code to ${{steps.identify_branch_name.outputs.branchName}} " + git push origin ${{steps.identify_branch_name.outputs.branchName}} + fi - # - name: Create PR - # shell: bash - # run: | - # if [ "${{steps.check-pr.outputs.pr_exists}}" == "false" ] && [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - # echo "Creating PR in OAS-version-update-10.1.0" - # gh pr create \ - # --title "OAS version update" \ - # --base master \ - # --head OAS-version-update-10.1.0 \ - # EOF - # )" - # fi - # env: - # GITHUB_TOKEN: ${{ github.token }} + - name: Create PR + shell: bash + run: | + if [ "${{steps.check-pr.outputs.pr_exists}}" == "false" ] && [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + echo "Creating PR in OAS-version-update-10.1.0" + gh pr create \ + --title "OAS version update" \ + --base master \ + --head OAS-version-update-10.1.0 \ + EOF + )" + fi + env: + GITHUB_TOKEN: ${{ github.token }} From a4573d10f423e90696691b5b26b9a73e810664b9 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 12:55:12 +0530 Subject: [PATCH 67/84] removed wromg prop[eryies --- .github/workflows/update-yaml-version.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 3fa85b032..d9e9e3efd 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -33,7 +33,6 @@ jobs: - name: Identify the branch name id: identify_branch_name - working-directory: xeroapi-sdk-codegen/ruby/scripts run: | branch_name='OAS-version-update-10.3.7' echo "branchName=$branch_name" >> $GITHUB_OUTPUT From 6cb76b2632084565da06af097f31ee6d609da08a Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 12:56:12 +0530 Subject: [PATCH 68/84] logging --- .github/workflows/update-yaml-version.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index d9e9e3efd..a085b5528 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -80,7 +80,8 @@ jobs: shell: bash run: | if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - echo "pushing the code to ${{steps.identify_branch_name.outputs.branchName}} " + echo "pushing the code to ${{steps.identify_branch_name.outputs.branchName}}" + git branch git push origin ${{steps.identify_branch_name.outputs.branchName}} fi From af1648cd69e05fd45a5427c91449bf7100635e70 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:00:04 +0530 Subject: [PATCH 69/84] logging statements added --- .github/workflows/update-yaml-version.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index a085b5528..881f569e1 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -46,13 +46,13 @@ jobs: git checkout ${{steps.identify_branch_name.outputs.branchName}} else echo "branch does not exists, creating new branch" - git checkout -b ${{steps.identify_branch_name.outputs.branchName}} + echo "branchName *****>> ${{steps.identify_branch_name.outputs.branchName}}" + git checkout -b ${{steps.identify_branch_name.outputs.branchName}} fi fi - name: Staging & commiting id: detect-changes - shell: bash run: | CHANGES_DETECTED=$(git diff) if [ -z "$CHANGES_DETECTED" ]; then @@ -61,6 +61,8 @@ jobs: else echo "changes_detected=true" >> $GITHUB_OUTPUT echo "running the git commands......" + + git branch echo 'staging the changes' git add --all @@ -77,7 +79,6 @@ jobs: fi - name: Pushing the Branch - shell: bash run: | if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then echo "pushing the code to ${{steps.identify_branch_name.outputs.branchName}}" @@ -86,14 +87,13 @@ jobs: fi - name: Create PR - shell: bash run: | if [ "${{steps.check-pr.outputs.pr_exists}}" == "false" ] && [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then echo "Creating PR in OAS-version-update-10.1.0" gh pr create \ --title "OAS version update" \ --base master \ - --head OAS-version-update-10.1.0 \ + --head ${{steps.identify_branch_name.outputs.branchName}} \ EOF )" fi From 2735d96878cadd2605d051e45d56d3b5e24a1a83 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:03:57 +0530 Subject: [PATCH 70/84] removed the condition --- .github/workflows/update-yaml-version.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 881f569e1..858c226c8 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -39,7 +39,6 @@ jobs: - name: Checkout branch run: | - if [ "${{github.event_name}}" == "push" ]; then if git ls-remote --heads origin ${{steps.identify_branch_name.outputs.branchName}} | grep -q "refs/heads/${{steps.identify_branch_name.outputs.branchName}}"; then echo "checking out existing branch" git fetch origin > /dev/null 2>&1 @@ -49,7 +48,6 @@ jobs: echo "branchName *****>> ${{steps.identify_branch_name.outputs.branchName}}" git checkout -b ${{steps.identify_branch_name.outputs.branchName}} fi - fi - name: Staging & commiting id: detect-changes From 3434b82ab5988f2267ac1cb4a5777713f21c549c Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:06:02 +0530 Subject: [PATCH 71/84] syntax correction for PR raise step --- .github/workflows/update-yaml-version.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 858c226c8..ab9bc15c7 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -87,13 +87,11 @@ jobs: - name: Create PR run: | if [ "${{steps.check-pr.outputs.pr_exists}}" == "false" ] && [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - echo "Creating PR in OAS-version-update-10.1.0" + echo "Creating PR in ${{steps.identify_branch_name.outputs.branchName}}" gh pr create \ --title "OAS version update" \ --base master \ --head ${{steps.identify_branch_name.outputs.branchName}} \ - EOF - )" fi env: GITHUB_TOKEN: ${{ github.token }} From f82a027a696ab670c09d9b6b744ff92f431b6c4f Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:13:02 +0530 Subject: [PATCH 72/84] syntax fix --- .github/workflows/update-yaml-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index ab9bc15c7..2ebe170e8 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -91,7 +91,7 @@ jobs: gh pr create \ --title "OAS version update" \ --base master \ - --head ${{steps.identify_branch_name.outputs.branchName}} \ + --head ${{steps.identify_branch_name.outputs.branchName}} fi env: GITHUB_TOKEN: ${{ github.token }} From 696dbf1d15e005f1baaa3064f315b75891783bd7 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:15:37 +0530 Subject: [PATCH 73/84] adjusted the if condition --- .github/workflows/update-yaml-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 2ebe170e8..c638f8919 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -86,7 +86,7 @@ jobs: - name: Create PR run: | - if [ "${{steps.check-pr.outputs.pr_exists}}" == "false" ] && [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then echo "Creating PR in ${{steps.identify_branch_name.outputs.branchName}}" gh pr create \ --title "OAS version update" \ From 1d18d2ec40e1f55caf1303e4d59763888b9169ba Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:17:09 +0530 Subject: [PATCH 74/84] added body to PR --- .github/workflows/update-yaml-version.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index c638f8919..fd62a4462 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -91,7 +91,8 @@ jobs: gh pr create \ --title "OAS version update" \ --base master \ - --head ${{steps.identify_branch_name.outputs.branchName}} + --head ${{steps.identify_branch_name.outputs.branchName}} \ + --body "chore: version update for all the yaml files" fi env: GITHUB_TOKEN: ${{ github.token }} From f889480cdfb4f1f925549948e8f3eb14f6beb438 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:23:25 +0530 Subject: [PATCH 75/84] fetch release version step added --- .github/workflows/update-yaml-version.yml | 134 ++++++++++++---------- 1 file changed, 71 insertions(+), 63 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index fd62a4462..2dc32d968 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -21,78 +21,86 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Update version of the yaml files + - name: Fetch Latest release number + id: get_latest_release_number run: | - ls - for file in xero_accounting.yaml xero_assets.yaml xero_bankfeeds.yaml xero_files.yaml xero-app-store.yaml xero-finance.yaml xero-identity.yaml xero-payroll-au.yaml xero-payroll-nz.yaml xero-payroll-uk.yaml xero-projects.yaml; do - yq eval ".info.version = \"10.1.0\"" -i "$file" - echo "updated version in $file" - done - head -n 20 xero_assets.yaml + latest_version=$(gh release view --json tagName --jq '.tagName') + echo "Latest release version is - $latest_version" + echo "releaseVersion=$latest_version" >> $GITHUB_OUTPUT + + # - name: Update version of the yaml files + # run: | + # ls + # for file in xero_accounting.yaml xero_assets.yaml xero_bankfeeds.yaml xero_files.yaml xero-app-store.yaml xero-finance.yaml xero-identity.yaml xero-payroll-au.yaml xero-payroll-nz.yaml xero-payroll-uk.yaml xero-projects.yaml; do + # yq eval ".info.version = \"10.1.0\"" -i "$file" + # echo "updated version in $file" + # done + # head -n 20 xero_assets.yaml - - name: Identify the branch name - id: identify_branch_name - run: | - branch_name='OAS-version-update-10.3.7' - echo "branchName=$branch_name" >> $GITHUB_OUTPUT - - name: Checkout branch - run: | - if git ls-remote --heads origin ${{steps.identify_branch_name.outputs.branchName}} | grep -q "refs/heads/${{steps.identify_branch_name.outputs.branchName}}"; then - echo "checking out existing branch" - git fetch origin > /dev/null 2>&1 - git checkout ${{steps.identify_branch_name.outputs.branchName}} - else - echo "branch does not exists, creating new branch" - echo "branchName *****>> ${{steps.identify_branch_name.outputs.branchName}}" - git checkout -b ${{steps.identify_branch_name.outputs.branchName}} - fi + # - name: Identify the branch name + # id: identify_branch_name + # run: | + # branch_name='OAS-version-update-10.3.7' + # echo "branchName=$branch_name" >> $GITHUB_OUTPUT - - name: Staging & commiting - id: detect-changes - run: | - CHANGES_DETECTED=$(git diff) - if [ -z "$CHANGES_DETECTED" ]; then - echo "no new changes, nothing to commit" - echo "changes_detected=false" >> $GITHUB_OUTPUT - else - echo "changes_detected=true" >> $GITHUB_OUTPUT - echo "running the git commands......" + # - name: Checkout branch + # run: | + # if git ls-remote --heads origin ${{steps.identify_branch_name.outputs.branchName}} | grep -q "refs/heads/${{steps.identify_branch_name.outputs.branchName}}"; then + # echo "checking out existing branch" + # git fetch origin > /dev/null 2>&1 + # git checkout ${{steps.identify_branch_name.outputs.branchName}} + # else + # echo "branch does not exists, creating new branch" + # echo "branchName *****>> ${{steps.identify_branch_name.outputs.branchName}}" + # git checkout -b ${{steps.identify_branch_name.outputs.branchName}} + # fi - git branch + # - name: Staging & commiting + # id: detect-changes + # run: | + # CHANGES_DETECTED=$(git diff) + # if [ -z "$CHANGES_DETECTED" ]; then + # echo "no new changes, nothing to commit" + # echo "changes_detected=false" >> $GITHUB_OUTPUT + # else + # echo "changes_detected=true" >> $GITHUB_OUTPUT + # echo "running the git commands......" + + # git branch - echo 'staging the changes' - git add --all + # echo 'staging the changes' + # git add --all - echo 'git status' - git diff + # echo 'git status' + # git diff - echo "git config setup" - git config --global user.name "Github Actions" - git config --global user.email "actions@github.com" + # echo "git config setup" + # git config --global user.name "Github Actions" + # git config --global user.email "actions@github.com" - echo 'commiting changes....' - git commit -m "chore: version update for all the yaml files" - fi + # echo 'commiting changes....' + # git commit -m "chore: version update for all the yaml files" + # fi - - name: Pushing the Branch - run: | - if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - echo "pushing the code to ${{steps.identify_branch_name.outputs.branchName}}" - git branch - git push origin ${{steps.identify_branch_name.outputs.branchName}} - fi + # - name: Pushing the Branch + # run: | + # if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + # echo "pushing the code to ${{steps.identify_branch_name.outputs.branchName}}" + # git branch + # git push origin ${{steps.identify_branch_name.outputs.branchName}} + # fi - - name: Create PR - run: | - if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - echo "Creating PR in ${{steps.identify_branch_name.outputs.branchName}}" - gh pr create \ - --title "OAS version update" \ - --base master \ - --head ${{steps.identify_branch_name.outputs.branchName}} \ - --body "chore: version update for all the yaml files" - fi - env: - GITHUB_TOKEN: ${{ github.token }} + # - name: Create PR + # run: | + # if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + # echo "Creating PR in ${{steps.identify_branch_name.outputs.branchName}}" + # gh pr create \ + # --title "OAS version update" \ + # --base master \ + # --head ${{steps.identify_branch_name.outputs.branchName}} \ + # --body "chore: version update for all the yaml files" + # fi + # env: + # GITHUB_TOKEN: ${{ github.token }} From ff416aabd50a5a5107147c45661d02cd7c452a37 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:24:08 +0530 Subject: [PATCH 76/84] added github token to the step --- .github/workflows/update-yaml-version.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 2dc32d968..91ab95211 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -27,6 +27,8 @@ jobs: latest_version=$(gh release view --json tagName --jq '.tagName') echo "Latest release version is - $latest_version" echo "releaseVersion=$latest_version" >> $GITHUB_OUTPUT + env: + GH_TOKEN: ${{ github.token }} # - name: Update version of the yaml files From 0794a6a8ff16037338f35a629fc988b6efaefe9b Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:35:54 +0530 Subject: [PATCH 77/84] Added the auto merge PR step --- .github/workflows/update-yaml-version.yml | 144 ++++++++++++---------- 1 file changed, 82 insertions(+), 62 deletions(-) diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 91ab95211..0cb8e2694 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -31,78 +31,98 @@ jobs: GH_TOKEN: ${{ github.token }} - # - name: Update version of the yaml files - # run: | - # ls - # for file in xero_accounting.yaml xero_assets.yaml xero_bankfeeds.yaml xero_files.yaml xero-app-store.yaml xero-finance.yaml xero-identity.yaml xero-payroll-au.yaml xero-payroll-nz.yaml xero-payroll-uk.yaml xero-projects.yaml; do - # yq eval ".info.version = \"10.1.0\"" -i "$file" - # echo "updated version in $file" - # done - # head -n 20 xero_assets.yaml + - name: Update version of the yaml files + run: | + ls + for file in xero_accounting.yaml xero_assets.yaml xero_bankfeeds.yaml xero_files.yaml xero-app-store.yaml xero-finance.yaml xero-identity.yaml xero-payroll-au.yaml xero-payroll-nz.yaml xero-payroll-uk.yaml xero-projects.yaml; do + yq eval ".info.version = \"10.1.0\"" -i "$file" + echo "updated version in $file" + done + head -n 20 xero_assets.yaml - # - name: Identify the branch name - # id: identify_branch_name - # run: | - # branch_name='OAS-version-update-10.3.7' - # echo "branchName=$branch_name" >> $GITHUB_OUTPUT + - name: Identify the branch name + id: identify_branch_name + run: | + branch_name='OAS-version-update-10.3.7' + echo "branchName=$branch_name" >> $GITHUB_OUTPUT - # - name: Checkout branch - # run: | - # if git ls-remote --heads origin ${{steps.identify_branch_name.outputs.branchName}} | grep -q "refs/heads/${{steps.identify_branch_name.outputs.branchName}}"; then - # echo "checking out existing branch" - # git fetch origin > /dev/null 2>&1 - # git checkout ${{steps.identify_branch_name.outputs.branchName}} - # else - # echo "branch does not exists, creating new branch" - # echo "branchName *****>> ${{steps.identify_branch_name.outputs.branchName}}" - # git checkout -b ${{steps.identify_branch_name.outputs.branchName}} - # fi - - # - name: Staging & commiting - # id: detect-changes - # run: | - # CHANGES_DETECTED=$(git diff) - # if [ -z "$CHANGES_DETECTED" ]; then - # echo "no new changes, nothing to commit" - # echo "changes_detected=false" >> $GITHUB_OUTPUT - # else - # echo "changes_detected=true" >> $GITHUB_OUTPUT - # echo "running the git commands......" - - # git branch + - name: Checkout branch + run: | + if git ls-remote --heads origin ${{steps.identify_branch_name.outputs.branchName}} | grep -q "refs/heads/${{steps.identify_branch_name.outputs.branchName}}"; then + echo "checking out existing branch" + git fetch origin > /dev/null 2>&1 + git checkout ${{steps.identify_branch_name.outputs.branchName}} + else + echo "branch does not exists, creating new branch" + echo "branchName *****>> ${{steps.identify_branch_name.outputs.branchName}}" + git checkout -b ${{steps.identify_branch_name.outputs.branchName}} + fi + + - name: Staging & commiting + id: detect-changes + run: | + CHANGES_DETECTED=$(git diff) + if [ -z "$CHANGES_DETECTED" ]; then + echo "no new changes, nothing to commit" + echo "changes_detected=false" >> $GITHUB_OUTPUT + else + echo "changes_detected=true" >> $GITHUB_OUTPUT + echo "running the git commands......" + + git branch - # echo 'staging the changes' - # git add --all + echo 'staging the changes' + git add --all - # echo 'git status' - # git diff + echo 'git status' + git diff - # echo "git config setup" - # git config --global user.name "Github Actions" - # git config --global user.email "actions@github.com" + echo "git config setup" + git config --global user.name "Github Actions" + git config --global user.email "actions@github.com" - # echo 'commiting changes....' - # git commit -m "chore: version update for all the yaml files" - # fi + echo 'commiting changes....' + git commit -m "chore: version update for all the yaml files" + fi - # - name: Pushing the Branch - # run: | - # if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - # echo "pushing the code to ${{steps.identify_branch_name.outputs.branchName}}" - # git branch - # git push origin ${{steps.identify_branch_name.outputs.branchName}} - # fi + - name: Pushing the Branch + run: | + if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + echo "pushing the code to ${{steps.identify_branch_name.outputs.branchName}}" + git branch + git push origin ${{steps.identify_branch_name.outputs.branchName}} + fi + + - name: Create PR + run: | + if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then + echo "Creating PR in ${{steps.identify_branch_name.outputs.branchName}}" + gh pr create \ + --title "OAS version update - x.x.x" \ + --base master \ + --head ${{steps.identify_branch_name.outputs.branchName}} \ + --body "chore: version update for all the yaml files" + fi + env: + GITHUB_TOKEN: ${{ github.token }} - # - name: Create PR + # - name: Auto Merge PR & deletes branch # run: | - # if [ "${{steps.detect-changes.outputs.changes_detected}}" == "true" ]; then - # echo "Creating PR in ${{steps.identify_branch_name.outputs.branchName}}" - # gh pr create \ - # --title "OAS version update" \ - # --base master \ - # --head ${{steps.identify_branch_name.outputs.branchName}} \ - # --body "chore: version update for all the yaml files" + # BRANCH_NAME=${{steps.identify_branch_name.outputs.branchName}} + # PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --json number --jq '. [0].number') + + # if [ -z "$PR_NUMBER" ]; then + # echo "No PR found for branch: $BRANCH_NAME" + # exit 1 # fi + + # echo "Merging the PR...." + + # gh pr merge $PR_NUMBER --merge --delete-branch --repo ${{github.repository}} + + # echo "PR #$PR_NUMBER has been merged & branch has been deleted" # env: # GITHUB_TOKEN: ${{ github.token }} + + From c1438704231146436e305b85e2dffc653ee8e8da Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 13:44:38 +0530 Subject: [PATCH 78/84] Added the basic release workflow --- .github/workflows/OAS-release.yml | 17 +++++++++++++++++ .../workflows/{pr.yml => pr-health-check.yml} | 0 2 files changed, 17 insertions(+) create mode 100644 .github/workflows/OAS-release.yml rename .github/workflows/{pr.yml => pr-health-check.yml} (100%) diff --git a/.github/workflows/OAS-release.yml b/.github/workflows/OAS-release.yml new file mode 100644 index 000000000..1ecd71eb8 --- /dev/null +++ b/.github/workflows/OAS-release.yml @@ -0,0 +1,17 @@ +name: Create release for Open API + +on: + workflow_dispatch: + + +jobs: + OAS-release: + runs-on: ubuntu-latest + + steps: + + - name: Checkout current repo + uses: actions/checkout@v4 + + - name: Release steps + uses: echo "this is manually triggered release....." \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr-health-check.yml similarity index 100% rename from .github/workflows/pr.yml rename to .github/workflows/pr-health-check.yml From c039f998b8c7c0dd2112a3ace4fc58b7a5f78f25 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 15:15:52 +0530 Subject: [PATCH 79/84] corrected indentation --- .github/workflows/OAS-release.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/OAS-release.yml b/.github/workflows/OAS-release.yml index 1ecd71eb8..b2a465575 100644 --- a/.github/workflows/OAS-release.yml +++ b/.github/workflows/OAS-release.yml @@ -6,11 +6,15 @@ on: jobs: OAS-release: - runs-on: ubuntu-latest + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write - steps: + steps: - - name: Checkout current repo + - name: Checkout Repository uses: actions/checkout@v4 - name: Release steps From 88d25e582e3f06089b9acab9f4ac8e06dda6b65d Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 26 Sep 2024 15:19:21 +0530 Subject: [PATCH 80/84] testing --- .github/workflows/OAS-release.yml | 2 +- .github/workflows/update-yaml-version.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/OAS-release.yml b/.github/workflows/OAS-release.yml index b2a465575..e0c5ebca4 100644 --- a/.github/workflows/OAS-release.yml +++ b/.github/workflows/OAS-release.yml @@ -1,7 +1,7 @@ name: Create release for Open API on: - workflow_dispatch: + workflow_dispatch: {} jobs: diff --git a/.github/workflows/update-yaml-version.yml b/.github/workflows/update-yaml-version.yml index 0cb8e2694..8f726370c 100644 --- a/.github/workflows/update-yaml-version.yml +++ b/.github/workflows/update-yaml-version.yml @@ -4,11 +4,11 @@ on: release: types: [published] - workflow_dispatch: + # workflow_dispatch: - pull_request: - paths: - - '**' + # pull_request: + # paths: + # - '**' jobs: Update-yaml-version: From 26acd7bdb8221613f0986df4c09d24c29737fbf5 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Thu, 26 Sep 2024 15:22:08 +0530 Subject: [PATCH 81/84] removed spaces --- .github/workflows/OAS-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/OAS-release.yml b/.github/workflows/OAS-release.yml index e0c5ebca4..2190816a3 100644 --- a/.github/workflows/OAS-release.yml +++ b/.github/workflows/OAS-release.yml @@ -1,8 +1,7 @@ name: Create release for Open API on: - workflow_dispatch: {} - + workflow_dispatch: jobs: OAS-release: From 2ae48d149750306748faf639233ac24aa77d7d3b Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Thu, 26 Sep 2024 15:24:30 +0530 Subject: [PATCH 82/84] corrected uses with run --- .github/workflows/OAS-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/OAS-release.yml b/.github/workflows/OAS-release.yml index 2190816a3..b9beb1642 100644 --- a/.github/workflows/OAS-release.yml +++ b/.github/workflows/OAS-release.yml @@ -17,4 +17,4 @@ jobs: uses: actions/checkout@v4 - name: Release steps - uses: echo "this is manually triggered release....." \ No newline at end of file + run: echo "this is manually triggered release....." \ No newline at end of file From dd2a60bdb5c409445967d0856e1ebf7083080775 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Thu, 26 Sep 2024 15:25:44 +0530 Subject: [PATCH 83/84] adds push event --- .github/workflows/OAS-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/OAS-release.yml b/.github/workflows/OAS-release.yml index b9beb1642..469665266 100644 --- a/.github/workflows/OAS-release.yml +++ b/.github/workflows/OAS-release.yml @@ -2,6 +2,7 @@ name: Create release for Open API on: workflow_dispatch: + push: jobs: OAS-release: From 5d8e2126c8729d59f68b7df3d7f8b5472ba40bd0 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Thu, 26 Sep 2024 15:26:26 +0530 Subject: [PATCH 84/84] removed on-push event --- .github/workflows/OAS-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/OAS-release.yml b/.github/workflows/OAS-release.yml index 469665266..b9beb1642 100644 --- a/.github/workflows/OAS-release.yml +++ b/.github/workflows/OAS-release.yml @@ -2,7 +2,6 @@ name: Create release for Open API on: workflow_dispatch: - push: jobs: OAS-release: