Commit b1ec7a0 1 parent 1eedcaa commit b1ec7a0 Copy full SHA for b1ec7a0
File tree 3 files changed +20
-13
lines changed
src/screens/sandbox/components/sidebar
3 files changed +20
-13
lines changed Original file line number Diff line number Diff line change 1
- name : Update Timestamp
1
+ name : Update Commit Timestamp
2
2
3
3
on :
4
4
push :
5
5
branches :
6
6
- main
7
7
8
8
jobs :
9
- update-timestamp :
9
+ update-commit- timestamp :
10
10
runs-on : ubuntu-latest
11
11
12
12
steps :
13
13
- name : Checkout repository
14
14
uses : actions/checkout@v2
15
15
16
16
- name : Extract Commit Timestamp
17
- run : echo "$(git log -1 --format=%ci)" > commit_timestamp.txt
18
-
19
- - name : Store Timestamp as Environment Variable
20
- run : echo "TIMESTAMP=$(cat commit_timestamp.txt)" >> $GITHUB_ENV
21
-
22
- - name : Upload Timestamp as Artifact
23
- uses : actions/upload-artifact@v2
24
- with :
25
- name : commit-timestamp
26
- path : commit_timestamp.txt
17
+ run : echo "COMMIT_TIMESTAMP=$(git log -1 --format=%ci)" >> $GITHUB_ENV
Original file line number Diff line number Diff line change
1
+ import { NextApiRequest , NextApiResponse } from 'next' ;
2
+
3
+ export default ( req : NextApiRequest , res : NextApiResponse ) => {
4
+ const timestamp = process . env . TIMESTAMP || 'N/A' ;
5
+ res . status ( 200 ) . json ( { timestamp } ) ;
6
+ } ;
Original file line number Diff line number Diff line change @@ -3,20 +3,30 @@ import Button from "@/src/components/Button.component";
3
3
import Link from "next/link" ;
4
4
import { Spacer } from "@/src/components/Components.styles" ;
5
5
import { useItems , useServices } from "../../hooks" ;
6
- import { useEffect } from "react" ;
6
+ import { useEffect , useState } from "react" ;
7
7
import ItemList from "./ItemList.component" ;
8
8
import { Examples } from "@/src/utils/examples" ;
9
9
import Logo from "@/src/components/Logo.component" ;
10
10
11
11
export default function Sidebar ( ) {
12
12
13
+ const [ timestamp , setTimestamp ] = useState ( "" ) ;
14
+
13
15
const { storageService, codeService, viewService } = useServices ( ) ;
14
16
const { items } = useItems ( ) ;
15
17
16
18
useEffect ( ( ) => {
17
19
initializeExamples ( ) ;
18
20
} , [ ] ) ;
19
21
22
+ useEffect ( ( ) => {
23
+ const timestamp = process . env . COMMIT_TIMESTAMP ;
24
+ console . log ( timestamp ) ;
25
+ if ( timestamp ) {
26
+ setTimestamp ( timestamp ) ;
27
+ }
28
+ } , [ ] ) ;
29
+
20
30
function reset ( ) : void {
21
31
codeService . reset ( ) ;
22
32
viewService . set ( 0 ) ;
You can’t perform that action at this time.
0 commit comments