Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PETOSS 536 | Open API Pipeline for PR creation #627

Closed
wants to merge 84 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
975d497
Added the basic pipeline code
Sep 18, 2024
576f30d
commented the JIRA workflow
Sep 18, 2024
ed6b8ea
yaml linting code
Sep 19, 2024
53f303e
adjusted the yamllint code
Sep 19, 2024
e7d0a6b
added git fetch
Sep 19, 2024
6d66ca0
corrected the find command syntax
Sep 19, 2024
022a462
added the github app access token step
Sep 19, 2024
84da4d1
added the octokit code
Sep 19, 2024
99b1cd0
added github workspace
Sep 19, 2024
da45a50
added a test change in files.yaml
Sep 19, 2024
fdacb25
Added the workflow disptach code for node
Sep 20, 2024
f06dd84
Added the bearer in the curl command
Sep 20, 2024
af884ee
testing workflow api
Sep 20, 2024
6d3154a
added permission to the workflow job
Sep 20, 2024
72abb4f
Added the PR branch name as input
Sep 20, 2024
dba10f4
syntax corrected of the json payload for curl
Sep 20, 2024
da4752a
Added all sdk workflow pr as dispatch call
Sep 21, 2024
c08ea3f
checking the response of the curl command
Sep 23, 2024
149be63
corrected the curl
Sep 23, 2024
786eaf2
fetching workflow run id
Sep 23, 2024
6d8bab9
testing
Sep 23, 2024
27997f3
testing response
Sep 23, 2024
efff19e
testing response object
Sep 23, 2024
59cc42c
testing random number generator
Sep 23, 2024
0d5260f
testing random number
Sep 23, 2024
9ac0f4f
added the disptach id in the input params of the dispatch call.
Sep 23, 2024
e0bb83a
corrected the dispatch call syntax
Sep 23, 2024
d21b5ae
refactored the json payload
Sep 23, 2024
9e9f124
added wait for completion in step
Sep 23, 2024
4fe77b2
corrected the syntax
Sep 23, 2024
2f6f784
Added the public action for trigger flow
Sep 23, 2024
2bef431
made propagate failure to true
Sep 23, 2024
6703efc
clean up commented code
Sep 24, 2024
d3053dc
Changed the ref to master in step
Sep 24, 2024
d8c5794
changed wait interval to 50
Sep 24, 2024
7c0229b
un commented yamllint step
Sep 24, 2024
c600051
Addec the new xero approved action
Sep 24, 2024
6454cfd
updated the version number of the action
Sep 24, 2024
22631d2
added distinct id
Sep 24, 2024
78ca8e2
updated the ref
Sep 24, 2024
cd149ad
timeout increased for the trigger step
Sep 24, 2024
d3e6d55
increased the time
Sep 24, 2024
5f96bc4
corrected the step details
Sep 24, 2024
bb3b68b
adjusted the time
Sep 24, 2024
dd87dd1
Added the time as string
Sep 24, 2024
da05a1d
used the beta version of the trigger action
Sep 24, 2024
1dad7c3
corrected the return dispatch version
Sep 24, 2024
3e8bab9
master branch is referenced
Sep 24, 2024
becdadb
corrected the ref
Sep 24, 2024
5454ca6
used the time in string
Sep 24, 2024
da826df
permission
Sep 25, 2024
3ec29b2
Added the feature branch for testing
Sep 25, 2024
03533f9
Added conditional step for merge flow
Sep 25, 2024
4641aaa
Added yq
Sep 25, 2024
1afb395
Added pr trigger condition
Sep 25, 2024
3c6b8dd
checking yq version
Sep 25, 2024
be589ba
using yq
Sep 25, 2024
d8ba71c
logging & testing
Sep 26, 2024
724be08
testing yq
Sep 26, 2024
7ca6957
testing
Sep 26, 2024
9039e84
Added all the yamls
Sep 26, 2024
e6bac9e
printing the yaml
Sep 26, 2024
cd10a84
Added the PR raise steps
Sep 26, 2024
1ed1ae7
checkout codegen repo
Sep 26, 2024
5796ceb
added path to checkout
Sep 26, 2024
f2c46c4
updated the version update workflow
Sep 26, 2024
a4573d1
removed wromg prop[eryies
Sep 26, 2024
6cb76b2
logging
Sep 26, 2024
af1648c
logging statements added
Sep 26, 2024
2735d96
removed the condition
Sep 26, 2024
3434b82
syntax correction for PR raise step
Sep 26, 2024
f82a027
syntax fix
Sep 26, 2024
696dbf1
adjusted the if condition
Sep 26, 2024
1d18d2e
added body to PR
Sep 26, 2024
f889480
fetch release version step added
Sep 26, 2024
ff416aa
added github token to the step
Sep 26, 2024
0794a6a
Added the auto merge PR step
Sep 26, 2024
c143870
Added the basic release workflow
Sep 26, 2024
c039f99
corrected indentation
Sep 26, 2024
88d25e5
testing
Sep 26, 2024
26acd7b
removed spaces
Sep 26, 2024
2ae48d1
corrected uses with run
Sep 26, 2024
dd2a60b
adds push event
Sep 26, 2024
5d8e212
removed on-push event
Sep 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/octokit/index.js
Original file line number Diff line number Diff line change
@@ -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
}
16 changes: 16 additions & 0 deletions .github/octokit/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
20 changes: 20 additions & 0 deletions .github/workflows/OAS-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Create release for Open API

on:
workflow_dispatch:

jobs:
OAS-release:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write

steps:

- name: Checkout Repository
uses: actions/checkout@v4

- name: Release steps
run: echo "this is manually triggered release....."
94 changes: 47 additions & 47 deletions .github/workflows/jira_create_issue.yml
Original file line number Diff line number Diff line change
@@ -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 }}
78 changes: 39 additions & 39 deletions .github/workflows/jira_update_issue_closed.yml
Original file line number Diff line number Diff line change
@@ -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"
78 changes: 39 additions & 39 deletions .github/workflows/jira_update_issue_reopen.yml
Original file line number Diff line number Diff line change
@@ -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"
Loading
Loading