fix: hotfix auto select starter template works without github token #release (#959)
Browse files* fix: hotfix starter template fix, updated header link to use navigate
* template auth fix
* updated changelog script
.github/scripts/generate-changelog.sh
CHANGED
@@ -137,7 +137,7 @@ while IFS= read -r commit_line; do
|
|
137 |
fi
|
138 |
|
139 |
CATEGORIES["$CATEGORY"]=1
|
140 |
-
COMMITS_BY_CATEGORY["$CATEGORY"]+="* ${PR_TITLE#*: } ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM)) by
|
141 |
else
|
142 |
COMMITS_BY_CATEGORY["$CATEGORY"]+="* ${PR_TITLE#*: } ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM))"$'\n'
|
143 |
fi
|
@@ -165,7 +165,7 @@ while IFS= read -r commit_line; do
|
|
165 |
CATEGORIES["$CATEGORY"]=1
|
166 |
COMMIT_TITLE=${COMMIT_MSG%% (#*} # Remove the PR number suffix
|
167 |
COMMIT_TITLE=${COMMIT_TITLE#*: } # Remove the type prefix
|
168 |
-
COMMITS_BY_CATEGORY["$CATEGORY"]+="* $COMMIT_TITLE ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM)) by
|
169 |
else
|
170 |
COMMIT_TITLE=${COMMIT_MSG%% (#*} # Remove the PR number suffix
|
171 |
COMMIT_TITLE=${COMMIT_TITLE#*: } # Remove the type prefix
|
@@ -196,7 +196,7 @@ while IFS= read -r commit_line; do
|
|
196 |
|
197 |
CATEGORIES["$CATEGORY"]=1
|
198 |
COMMIT_TITLE=${COMMIT_MSG#*: } # Remove the type prefix
|
199 |
-
COMMITS_BY_CATEGORY["$CATEGORY"]+="* $COMMIT_TITLE (${HASH:0:7}) by
|
200 |
else
|
201 |
# Fallback to git author name if no GitHub username found
|
202 |
AUTHOR_NAME=$(git show -s --format='%an' "$HASH")
|
|
|
137 |
fi
|
138 |
|
139 |
CATEGORIES["$CATEGORY"]=1
|
140 |
+
COMMITS_BY_CATEGORY["$CATEGORY"]+="* ${PR_TITLE#*: } ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM)) by @$GITHUB_USERNAME"$'\n'
|
141 |
else
|
142 |
COMMITS_BY_CATEGORY["$CATEGORY"]+="* ${PR_TITLE#*: } ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM))"$'\n'
|
143 |
fi
|
|
|
165 |
CATEGORIES["$CATEGORY"]=1
|
166 |
COMMIT_TITLE=${COMMIT_MSG%% (#*} # Remove the PR number suffix
|
167 |
COMMIT_TITLE=${COMMIT_TITLE#*: } # Remove the type prefix
|
168 |
+
COMMITS_BY_CATEGORY["$CATEGORY"]+="* $COMMIT_TITLE ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM)) by @$GITHUB_USERNAME"$'\n'
|
169 |
else
|
170 |
COMMIT_TITLE=${COMMIT_MSG%% (#*} # Remove the PR number suffix
|
171 |
COMMIT_TITLE=${COMMIT_TITLE#*: } # Remove the type prefix
|
|
|
196 |
|
197 |
CATEGORIES["$CATEGORY"]=1
|
198 |
COMMIT_TITLE=${COMMIT_MSG#*: } # Remove the type prefix
|
199 |
+
COMMITS_BY_CATEGORY["$CATEGORY"]+="* $COMMIT_TITLE (${HASH:0:7}) by @$GITHUB_USERNAME"$'\n'
|
200 |
else
|
201 |
# Fallback to git author name if no GitHub username found
|
202 |
AUTHOR_NAME=$(git show -s --format='%an' "$HASH")
|
.github/workflows/update-stable.yml
CHANGED
@@ -88,6 +88,8 @@ jobs:
|
|
88 |
id: changelog
|
89 |
env:
|
90 |
NEW_VERSION: ${{ steps.bump_version.outputs.new_version }}
|
|
|
|
|
91 |
run: .github/scripts/generate-changelog.sh
|
92 |
|
93 |
- name: Get the latest commit hash and version tag
|
|
|
88 |
id: changelog
|
89 |
env:
|
90 |
NEW_VERSION: ${{ steps.bump_version.outputs.new_version }}
|
91 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
92 |
+
|
93 |
run: .github/scripts/generate-changelog.sh
|
94 |
|
95 |
- name: Get the latest commit hash and version tag
|
app/utils/selectStarterTemplate.ts
CHANGED
@@ -2,6 +2,7 @@ import ignore from 'ignore';
|
|
2 |
import type { ProviderInfo } from '~/types/model';
|
3 |
import type { Template } from '~/types/template';
|
4 |
import { STARTER_TEMPLATES } from './constants';
|
|
|
5 |
|
6 |
const starterTemplateSelectionPrompt = (templates: Template[]) => `
|
7 |
You are an experienced developer who helps people choose the best starter template for their projects.
|
@@ -116,14 +117,20 @@ const getGitHubRepoContent = async (
|
|
116 |
const baseUrl = 'https://api.github.com';
|
117 |
|
118 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
// Fetch contents of the path
|
120 |
const response = await fetch(`${baseUrl}/repos/${repoName}/contents/${path}`, {
|
121 |
-
headers
|
122 |
-
Accept: 'application/vnd.github.v3+json',
|
123 |
-
|
124 |
-
// Add your GitHub token if needed
|
125 |
-
Authorization: 'token ' + import.meta.env.VITE_GITHUB_ACCESS_TOKEN,
|
126 |
-
},
|
127 |
});
|
128 |
|
129 |
if (!response.ok) {
|
@@ -156,10 +163,7 @@ const getGitHubRepoContent = async (
|
|
156 |
} else if (item.type === 'file') {
|
157 |
// Fetch file content
|
158 |
const fileResponse = await fetch(item.url, {
|
159 |
-
headers
|
160 |
-
Accept: 'application/vnd.github.v3+json',
|
161 |
-
Authorization: 'token ' + import.meta.env.VITE_GITHUB_ACCESS_TOKEN,
|
162 |
-
},
|
163 |
});
|
164 |
const fileData: any = await fileResponse.json();
|
165 |
const content = atob(fileData.content); // Decode base64 content
|
|
|
2 |
import type { ProviderInfo } from '~/types/model';
|
3 |
import type { Template } from '~/types/template';
|
4 |
import { STARTER_TEMPLATES } from './constants';
|
5 |
+
import Cookies from 'js-cookie';
|
6 |
|
7 |
const starterTemplateSelectionPrompt = (templates: Template[]) => `
|
8 |
You are an experienced developer who helps people choose the best starter template for their projects.
|
|
|
117 |
const baseUrl = 'https://api.github.com';
|
118 |
|
119 |
try {
|
120 |
+
const token = Cookies.get('githubToken') || import.meta.env.VITE_GITHUB_ACCESS_TOKEN;
|
121 |
+
|
122 |
+
const headers: HeadersInit = {
|
123 |
+
Accept: 'application/vnd.github.v3+json',
|
124 |
+
};
|
125 |
+
|
126 |
+
// Add your GitHub token if needed
|
127 |
+
if (token) {
|
128 |
+
headers.Authorization = 'token ' + token;
|
129 |
+
}
|
130 |
+
|
131 |
// Fetch contents of the path
|
132 |
const response = await fetch(`${baseUrl}/repos/${repoName}/contents/${path}`, {
|
133 |
+
headers,
|
|
|
|
|
|
|
|
|
|
|
134 |
});
|
135 |
|
136 |
if (!response.ok) {
|
|
|
163 |
} else if (item.type === 'file') {
|
164 |
// Fetch file content
|
165 |
const fileResponse = await fetch(item.url, {
|
166 |
+
headers,
|
|
|
|
|
|
|
167 |
});
|
168 |
const fileData: any = await fileResponse.json();
|
169 |
const content = atob(fileData.content); // Decode base64 content
|