Skip to content

Commit 25a9b83

Browse files
committed
Fix invalid url when being referenced by project id alias
Closes FirebaseExtended#213
1 parent 120e124 commit 25a9b83

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/getProjectIdByAlias.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { readFileSync } from "fs";
2+
3+
export function getProjectIdByAlias(alias: string): string {
4+
const firebaserc = JSON.parse(readFileSync(".firebaserc", { encoding: 'utf-8' }));
5+
return firebaserc.projects[alias];
6+
}

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
getURLsMarkdownFromChannelDeployResult,
3737
postChannelSuccessComment,
3838
} from "./postOrUpdateComment";
39+
import { getProjectIdByAlias } from "./getProjectIdByAlias";
3940

4041
// Inputs defined in action.yml
4142
const expires = getInput("expires");
@@ -99,7 +100,8 @@ async function run() {
99100
}
100101
endGroup();
101102

102-
const hostname = target ? `${target}.web.app` : `${projectId}.web.app`;
103+
const parsedProjectId = getProjectIdByAlias(projectId) || projectId;
104+
const hostname = target ? `${target}.web.app` : `${parsedProjectId}.web.app`;
103105
const url = `https://${hostname}/`;
104106
await finish({
105107
details_url: url,

0 commit comments

Comments
 (0)