Skip to content

Commit

Permalink
ci: read pr from github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustav-Eikaas committed Aug 11, 2023
1 parent fc0a747 commit e2a9511
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:

- name: 'deploy'
shell: bash
run: npx turbo run idk --since origin/main -- --token ${{ env.FUSION_TOKEN }}
run: npx turbo run idk --since origin/main -- --token ${{ env.FUSION_TOKEN }} --pr ${{ github.event.number }}
17 changes: 11 additions & 6 deletions github-action/src/releasePr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { Command } from 'commander';
import fs from 'fs';
import { chdir, cwd } from 'process';
import { execSync } from 'child_process';
import { parsePackageJson } from './parsePackageJson.js';
import { resolve } from 'path';
Expand All @@ -19,17 +18,18 @@ program.name('Release');
program
.command('release')
.option('-T, --token <token>', 'change the working directory')
.option('-pr --pr <pr>', 'Pr number')
.action(async (args) => {
if (!args.token) {
throw new Error('Missing az token');
}
setSecret(args.token);
release(args.token);
release(args.token, args.pr);
});

await program.parseAsync();

export async function release(token: string) {
export async function release(token: string, prNumber: string) {
// Vite build
notice('bundling application');
prepareBundle();
Expand All @@ -49,10 +49,15 @@ export async function release(token: string) {
);
}

await uploadBundle(token, r.name, zipped);
await uploadBundle(token, r.name, zipped, prNumber);
}

async function uploadBundle(token: string, appKey: string, zipped: AdmZip) {
async function uploadBundle(
token: string,
appKey: string,
zipped: AdmZip,
prNumber: string
) {
const client = new HttpClient();

const headers: OutgoingHttpHeaders = {
Expand Down Expand Up @@ -82,7 +87,7 @@ async function uploadBundle(token: string, appKey: string, zipped: AdmZip) {
// headers
// );

await patchWithPrNumber('59', token, appKey);
await patchWithPrNumber(prNumber, token, appKey);
}

function prepareBundle() {
Expand Down

0 comments on commit e2a9511

Please sign in to comment.