Skip to content

Commit

Permalink
Add get details (#19)
Browse files Browse the repository at this point in the history
* feat: add validator

* feat: add validator

* feat: minor improvemnets

* feat: dist created

* feat: minor changes

* feat: minor changes

* feat: minor changes

* feat: minor changes

* feat: add get detail functionality

* feat: add js files

* feat: add js files

* feat: add js files
  • Loading branch information
yogeshpaliyal authored Apr 21, 2024
1 parent 62b2c78 commit d817e03
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 10 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,27 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: Test Local Action
# - name: Test Local Action
# id: test-action
# uses: ./
# with:
# type: "UPLOAD_AAB"
# apiKey: ${{secrets.INDUS_API_KEY}}
# packageName: com.yogeshpaliyal.keypass
# aabFile: ./tempFiles/*.aab
# signingKeyBase64: ${{ secrets.SIGNING_KEY }}
# keystoreAlias: ${{ secrets.ALIAS }}
# keystorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
# keyPassword: ${{ secrets.KEY_PASSWORD }}

- name: Test Get App Detail
id: test-action
uses: ./
with:
type: "UPLOAD_AAB"
type: "GET_APP_DETAILS"
apiKey: ${{secrets.INDUS_API_KEY}}
packageName: com.yogeshpaliyal.keypass
aabFile: ./tempFiles/*.aab
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
keystoreAlias: ${{ secrets.ALIAS }}
keystorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}

- name: Print Output
id: output
run: echo "Success"
run: echo ${{ steps.test-action.outputs.result }} "Success"
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ inputs:
required: false
default: ''

outputs:
result:
description: 'Result of the job'

runs:
using: node20
main: dist/index.js
67 changes: 66 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { UploadAAb } from './validator/uploadAab'
import { ActionType, BaseProps } from './constants'
import { UploadApk } from './validator/UploadApk'
import { IValidator } from './validator/IValidator'
import { GetAppDetail } from './validator/getAppDetail'

/**
* The main function for the action.
Expand All @@ -14,7 +15,8 @@ export async function run(): Promise<void> {

const validators: IValidator<BaseProps>[] = [
new UploadAAb(),
new UploadApk()
new UploadApk(),
new GetAppDetail()
]
for (let i = 0; i < validators.length; i++) {

Check warning on line 21 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Expected a `for-of` loop instead of a `for` loop with this simple iteration
const validator = validators[i]
Expand Down
43 changes: 43 additions & 0 deletions src/validator/getAppDetail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { ActionType, BaseProps } from 'src/constants'
import { IValidator } from './IValidator'
import * as core from '@actions/core'
import { validateStringParameter } from 'src/utils'

export interface GetAppDetailProps extends BaseProps {
packageName: string
}

export class GetAppDetail extends IValidator<GetAppDetailProps> {
public type: ActionType = ActionType.GET_APP_DETAILS

public validateVariables(): GetAppDetailProps {
const data = super.validateVariables()
const packageName: string = core.getInput('packageName')

validateStringParameter('packageName', packageName);

return {
...data,
packageName,
}
}

public async createAntHitRequest(props: GetAppDetailProps) {
const headers = {
Authorization: `Bearer ${props.apiKey}`
}


const axios = require('axios')

const response = await axios.get(
`https://developer-api.indusappstore.com/apis/indus-developerdashboard-service/devtools/app/details/${props.packageName}`,
{ headers }
)
console.log(response.statusText)
console.log(response.status)
console.log(response.data)
core.debug(response.data)
core.setOutput("result", response.data)
}
}

0 comments on commit d817e03

Please sign in to comment.