Skip to content

Commit 4c11308

Browse files
[PETOSS-829] Add codegen testing and replace linters (#757)
- New check to validate that codegen via Xero internal repo succeeds. - New way to create GitHub Release. - Swapped spectral and yamllint checks for MegaLinter. --------- Co-authored-by: Chris Mitchell <[email protected]>
1 parent a5acbc3 commit 4c11308

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+7196
-6317
lines changed

.github/get-access-token/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {Octokit} from "@octokit/rest";
2+
import {createAppAuth} from "@octokit/auth-app"
3+
4+
export const getAccessToken = async () => {
5+
6+
const {GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY} = process.env
7+
8+
const octoKitInstance = new Octokit({
9+
authStrategy: createAppAuth,
10+
auth: {
11+
appId: GITHUB_APP_ID,
12+
privateKey: GITHUB_APP_PRIVATE_KEY
13+
}
14+
});
15+
16+
const {data: installations} = await octoKitInstance.rest.apps.listInstallations()
17+
18+
if(!installations.length) {
19+
throw new Error("No Installations found for this github app")
20+
}
21+
22+
const installationId = installations[0].id;
23+
24+
const installationAccessToken = await octoKitInstance.rest.apps.createInstallationAccessToken({installation_id: installationId})
25+
26+
return installationAccessToken.data.token
27+
}

.github/get-access-token/package-lock.json

Lines changed: 331 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "get-access-token",
3+
"main": "index.js",
4+
"type": "module",
5+
"dependencies": {
6+
"@octokit/auth-app": "^7.1.1",
7+
"@octokit/rest": "^21.0.2"
8+
}
9+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"branches": [
3+
"master"
4+
],
5+
"tagFormat": "${version}",
6+
"plugins": [
7+
[
8+
"@semantic-release/release-notes-generator",
9+
{
10+
"preset": "angular",
11+
"writerOpts": {
12+
"headerPartial": "## What's changed",
13+
"footerPartial": "\n**Full Changelog**:https://github.com/XeroAPI/Xero-OpenAPI/compare/{{previousTag}}...{{version}}"
14+
}
15+
}
16+
],
17+
"@semantic-release/commit-analyzer",
18+
"@semantic-release/github",
19+
"@semantic-release/git"
20+
]
21+
}

0 commit comments

Comments
 (0)