File tree 5 files changed +57
-47
lines changed
5 files changed +57
-47
lines changed Original file line number Diff line number Diff line change @@ -11,31 +11,24 @@ concurrency:
11
11
cancel-in-progress : false
12
12
13
13
jobs :
14
- build :
15
- name : build
14
+ build-deploy :
15
+ name : build-deploy
16
16
runs-on : ubuntu-latest
17
17
env :
18
18
NEXT_PUBLIC_BASE_PATH : /norwegian-public-organizations
19
+ VERCEL_ORG_ID : ${{ secrets.VERCEL_ORG_ID }}
20
+ VERCEL_PROJECT_ID : ${{ secrets.VERCEL_PROJECT_ID }}
21
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
19
22
steps :
20
23
- name : Checkout
21
24
uses : actions/checkout@v4
22
25
- name : setup bun
23
26
uses : oven-sh/setup-bun@v1
24
- - name : Install packages
25
- run : bun install
26
- - name : Build
27
- run : bun run build
28
- - name : Upload artifact
29
- uses : actions/upload-pages-artifact@v3
30
- with :
31
- path : ./out
32
- deploy :
33
- environment :
34
- name : github-pages
35
- url : ${{ steps.deployment.outputs.page_url }}
36
- runs-on : ubuntu-latest
37
- needs : build
38
- steps :
39
- - name : Deploy to GitHub Pages
40
- id : deployment
41
- uses : actions/deploy-pages@v4
27
+ - name : Install Vercel CLI
28
+ run : bun install --global vercel@latest
29
+ - name : Pull Vercel Environment Information
30
+ run : vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
31
+ - name : Build Project Artifacts
32
+ run : vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
33
+ - name : Deploy Project Artifacts to Vercel
34
+ run : vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
Original file line number Diff line number Diff line change @@ -20,6 +20,15 @@ Install deps:
20
20
bun run build
21
21
```
22
22
23
+ Environment variable:
24
+ Need to set an environment variable
25
+ GH_TOKEN to your GitHub token
26
+ ``` bash
27
+ .bashrc example:
28
+ ` ` ` shell bash
29
+ export GH_TOKEN=' supersecretkey'
30
+ ` ` `
31
+
23
32
First, run the development server:
24
33
` ` ` bash
25
34
bun run dev
@@ -28,7 +37,7 @@ bun run dev
28
37
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
29
38
30
39
# # Deployed to GitHub pages
31
- The application is live at: https://mikaojk.github.io /norwegian-public-organizations
40
+ The application is live at: https://norwegian-public-organizations.vercel.app /norwegian-public-organizations
32
41
33
42
# # Organization is missing!!
34
43
Follow the guide in the: [CONTRIBUTING.md](CONTRIBUTING.md)
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const nextConfig = {
6
6
loader : 'akamai' ,
7
7
path : '/'
8
8
} ,
9
- output : 'export '
9
+ output : 'standalone '
10
10
}
11
11
12
12
module . exports = nextConfig
Original file line number Diff line number Diff line change
1
+ 'use server' ;
2
+
3
+ import { Octokit } from "@octokit/core" ;
4
+ import { paginateRest } from "@octokit/plugin-paginate-rest" ;
5
+ import { retry } from "@octokit/plugin-retry" ;
6
+
7
+
8
+ async function getNumberOfPublicRepos ( owner : string ) : Promise < number > {
9
+
10
+ const octokitplugin = Octokit . plugin ( paginateRest , retry ) . defaults ( {
11
+ userAgent : "norwegian-public-organizations" ,
12
+ auth : process . env . GH_TOKEN
13
+ } ) ;
14
+
15
+ const myOctokit = new octokitplugin ( )
16
+
17
+ try {
18
+ const repos = await myOctokit . request ( `GET /orgs/${ owner } ` , {
19
+ headers : {
20
+ 'X-GitHub-Api-Version' : '2022-11-28'
21
+ }
22
+ } )
23
+
24
+ return repos . data . public_repos
25
+ } catch ( e ) {
26
+ console . log ( e )
27
+ return 0
28
+ }
29
+ }
30
+
31
+ export default getNumberOfPublicRepos
32
+
Original file line number Diff line number Diff line change 2
2
3
3
import React , { useEffect , useState } from 'react' ;
4
4
import organizations from "./data/organizations.json" ;
5
- import { Octokit } from "@octokit/core" ;
6
- import { paginateRest } from "@octokit/plugin-paginate-rest" ;
7
- import { retry } from "@octokit/plugin-retry" ;
5
+ import getNumberOfPublicRepos from "../app/api/github" ;
8
6
9
7
export interface OrganizationsJson {
10
8
id : number ;
@@ -86,25 +84,3 @@ export const OrganizationsOnGithub = () => {
86
84
}
87
85
88
86
89
- async function getNumberOfPublicRepos ( owner : string ) : Promise < number > {
90
- const octokitplugin = Octokit . plugin ( paginateRest , retry ) . defaults ( {
91
- userAgent : "norwegian-public-organizations" ,
92
- /// auth: 'mysupersecrettoken'
93
- } ) ;
94
-
95
- const myOctokit = new octokitplugin ( )
96
-
97
- try {
98
- const repos = await myOctokit . request ( `GET /orgs/${ owner } ` , {
99
- headers : {
100
- 'X-GitHub-Api-Version' : '2022-11-28'
101
- }
102
- } )
103
-
104
- return repos . data . public_repos
105
- } catch ( e ) {
106
- console . log ( e )
107
- return 0
108
- }
109
- }
110
-
You can’t perform that action at this time.
0 commit comments