mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-22 10:55:34 +00:00
fix: hotfix auto select starter template works without github token #release (#959)
* fix: hotfix starter template fix, updated header link to use navigate * template auth fix * updated changelog script
This commit is contained in:
parent
1cf83454ed
commit
67d984c52c
6
.github/scripts/generate-changelog.sh
vendored
6
.github/scripts/generate-changelog.sh
vendored
@ -137,7 +137,7 @@ while IFS= read -r commit_line; do
|
||||
fi
|
||||
|
||||
CATEGORIES["$CATEGORY"]=1
|
||||
COMMITS_BY_CATEGORY["$CATEGORY"]+="* ${PR_TITLE#*: } ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM)) by [@$GITHUB_USERNAME](https://github.com/$GITHUB_USERNAME)"$'\n'
|
||||
COMMITS_BY_CATEGORY["$CATEGORY"]+="* ${PR_TITLE#*: } ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM)) by @$GITHUB_USERNAME"$'\n'
|
||||
else
|
||||
COMMITS_BY_CATEGORY["$CATEGORY"]+="* ${PR_TITLE#*: } ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM))"$'\n'
|
||||
fi
|
||||
@ -165,7 +165,7 @@ while IFS= read -r commit_line; do
|
||||
CATEGORIES["$CATEGORY"]=1
|
||||
COMMIT_TITLE=${COMMIT_MSG%% (#*} # Remove the PR number suffix
|
||||
COMMIT_TITLE=${COMMIT_TITLE#*: } # Remove the type prefix
|
||||
COMMITS_BY_CATEGORY["$CATEGORY"]+="* $COMMIT_TITLE ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM)) by [@$GITHUB_USERNAME](https://github.com/$GITHUB_USERNAME)"$'\n'
|
||||
COMMITS_BY_CATEGORY["$CATEGORY"]+="* $COMMIT_TITLE ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM)) by @$GITHUB_USERNAME"$'\n'
|
||||
else
|
||||
COMMIT_TITLE=${COMMIT_MSG%% (#*} # Remove the PR number suffix
|
||||
COMMIT_TITLE=${COMMIT_TITLE#*: } # Remove the type prefix
|
||||
@ -196,7 +196,7 @@ while IFS= read -r commit_line; do
|
||||
|
||||
CATEGORIES["$CATEGORY"]=1
|
||||
COMMIT_TITLE=${COMMIT_MSG#*: } # Remove the type prefix
|
||||
COMMITS_BY_CATEGORY["$CATEGORY"]+="* $COMMIT_TITLE (${HASH:0:7}) by [@$GITHUB_USERNAME](https://github.com/$GITHUB_USERNAME)"$'\n'
|
||||
COMMITS_BY_CATEGORY["$CATEGORY"]+="* $COMMIT_TITLE (${HASH:0:7}) by @$GITHUB_USERNAME"$'\n'
|
||||
else
|
||||
# Fallback to git author name if no GitHub username found
|
||||
AUTHOR_NAME=$(git show -s --format='%an' "$HASH")
|
||||
|
2
.github/workflows/update-stable.yml
vendored
2
.github/workflows/update-stable.yml
vendored
@ -88,6 +88,8 @@ jobs:
|
||||
id: changelog
|
||||
env:
|
||||
NEW_VERSION: ${{ steps.bump_version.outputs.new_version }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
run: .github/scripts/generate-changelog.sh
|
||||
|
||||
- name: Get the latest commit hash and version tag
|
||||
|
@ -2,6 +2,7 @@ import ignore from 'ignore';
|
||||
import type { ProviderInfo } from '~/types/model';
|
||||
import type { Template } from '~/types/template';
|
||||
import { STARTER_TEMPLATES } from './constants';
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
const starterTemplateSelectionPrompt = (templates: Template[]) => `
|
||||
You are an experienced developer who helps people choose the best starter template for their projects.
|
||||
@ -116,14 +117,20 @@ const getGitHubRepoContent = async (
|
||||
const baseUrl = 'https://api.github.com';
|
||||
|
||||
try {
|
||||
const token = Cookies.get('githubToken') || import.meta.env.VITE_GITHUB_ACCESS_TOKEN;
|
||||
|
||||
const headers: HeadersInit = {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
};
|
||||
|
||||
// Add your GitHub token if needed
|
||||
if (token) {
|
||||
headers.Authorization = 'token ' + token;
|
||||
}
|
||||
|
||||
// Fetch contents of the path
|
||||
const response = await fetch(`${baseUrl}/repos/${repoName}/contents/${path}`, {
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
|
||||
// Add your GitHub token if needed
|
||||
Authorization: 'token ' + import.meta.env.VITE_GITHUB_ACCESS_TOKEN,
|
||||
},
|
||||
headers,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@ -156,10 +163,7 @@ const getGitHubRepoContent = async (
|
||||
} else if (item.type === 'file') {
|
||||
// Fetch file content
|
||||
const fileResponse = await fetch(item.url, {
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: 'token ' + import.meta.env.VITE_GITHUB_ACCESS_TOKEN,
|
||||
},
|
||||
headers,
|
||||
});
|
||||
const fileData: any = await fileResponse.json();
|
||||
const content = atob(fileData.content); // Decode base64 content
|
||||
|
Loading…
Reference in New Issue
Block a user