Skip to content

Commit

Permalink
fix: fix GitHub Actions envs
Browse files Browse the repository at this point in the history
  • Loading branch information
oriverk committed Mar 25, 2024
1 parent 1a2b67e commit 301ac8c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
5 changes: 1 addition & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ PUBLIC_ALGOLIA_APP_ID=\w+
PUBLIC_ALGOLIA_SEARCH_KEY=\w+
SECRET_ALGOLIA_ADMIN_KEY=\w+

SECRET_GITHUB_PERSONAL_ACCESS_TOKEN=\w+
GITHUB_USER_NAME=\w+
GITHUB_REPOSITORY_NAME=\w+
GITHUB_REPOSITORY_EXPRESSION=HEAD:\w+/\w+.md
SECRET_GH_PAT=\w+
5 changes: 2 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
npm run build
env:
MODE: production
SECRET_GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.SECRET_GITHUB_PERSONAL_ACCESS_TOKEN }}
PUBLIC_GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}
SECRET_GH_PAT: ${{ secrets.SECRET_GH_PAT }}
PUBLIC_ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
PUBLIC_ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }}
PUBLIC_ALGOLIA_INDEX_BLOG: ${{ secrets.ALGOLIA_INDEX_BLOG }}
Expand All @@ -45,4 +44,4 @@ jobs:
projectName: astro-site
directory: dist
# Optional: Enable this if you want to have GitHub Deployments triggered
# gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# gitHubToken: ${{ secrets.SECRET_GH_PAT }}
9 changes: 5 additions & 4 deletions script/getGitHubRepositoryContent.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { graphql, GraphqlResponseError } from '@octokit/graphql'
import { format } from 'date-fns'
import fs from 'fs-extra'
import siteConfig from 'site.config'

/**
* @param {string} birthdate '2020-01-01'
Expand Down Expand Up @@ -74,10 +75,10 @@ async function fetchRepositoryContent(githubToken, owner, repo, expression) {
}

;(async () => {
const token = process.env.SECRET_GITHUB_PERSONAL_ACCESS_TOKEN || ''
const owner = process.env.GITHUB_USER_NAME || ''
const repositoryName = process.env.GITHUB_REPOSITORY_NAME || ''
const repositoryExpression = process.env.GITHUB_REPOSITORY_EXPRESSION || ''
const token = process.env.SECRET_GH_PAT || "";
const owner = siteConfig.github || ''
const repositoryName = siteConfig.docsGitHubRepositoryName || ''
const repositoryExpression = siteConfig.docsGitHubRepositoryExpression || ''

if (!token || !owner || !repositoryName || !repositoryExpression) {
return console.error('Env is Not Found.')
Expand Down
5 changes: 3 additions & 2 deletions script/getGitHubUserContent.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { graphql, GraphqlResponseError } from '@octokit/graphql'
import { subYears, startOfWeek, format } from 'date-fns'
import fs from 'fs-extra'
import siteConfig from "../site.config"

/**
* @param {string} githubToken
Expand Down Expand Up @@ -78,8 +79,8 @@ async function fetchUserContent(githubToken, owner, pinnedItemsNum, calendarFrom
}

;(async () => {
const token = process.env.SECRET_GITHUB_PERSONAL_ACCESS_TOKEN || ''
const owner = process.env.GITHUB_USER_NAME || ''
const token = process.env.SECRET_GH_PAT || "";
const owner = siteConfig.github || ''

if (!token || !owner) {
return console.log('Env is Not Found.')
Expand Down
2 changes: 2 additions & 0 deletions site.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export default {
description: "My site description",
siteRoot: import.meta.env.PROD ? "https://oriverk.dev" : "http://localhost:3000",
github: 'oriverk',
docsGitHubRepositoryName: 'oriverk-docs',
docsGitHubRepositoryExpression: "HEAD:cv/index.md",
zenn: 'oriverk',
x: 'not_you_die',
}

0 comments on commit 301ac8c

Please sign in to comment.