Skip to content

Commit bf380bc

Browse files
authored
Fix cache (#33)
1 parent 47d9b57 commit bf380bc

File tree

1 file changed

+14
-25
lines changed

1 file changed

+14
-25
lines changed

action.yml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,18 @@ inputs:
3131
runs:
3232
using: 'composite'
3333
steps:
34+
- name: Set start time
35+
id: start
36+
run: echo "timestamp=$EPOCHSECONDS" >> $GITHUB_OUTPUT
37+
shell: bash
38+
3439
- name: Cache gitstream folder
3540
id: cache-gitstream
3641
uses: actions/cache@v3
3742
with:
3843
path: gitstream
39-
key: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).repo }}-gitsream-cache
40-
restore-keys: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).repo }}-gitsream-cache
41-
42-
- name: Set start time
43-
id: start
44-
run: echo "timestamp=$EPOCHSECONDS" >> $GITHUB_OUTPUT
45-
shell: bash
46-
44+
key: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).headSha }}-${{ fromJSON(fromJSON(github.event.inputs.client_payload)).repo }}-gitsream-cache
45+
4746
- name: Create GitStream folder
4847
## this step will be skipped if cache exists
4948
if: ${{ steps.cache-gitstream.outputs.cache-hit != 'true' }}
@@ -53,17 +52,18 @@ runs:
5352
mkdir gitstream
5453
cd gitstream
5554
mkdir repo
56-
55+
mkdir temp
56+
5757
- name: Checkout head branch
5858
## this step will be skipped if cache exists
59-
if: ${{ steps.cache-gitstream.outputs.cache-hit != 'true' }}
6059
uses: actions/checkout@v3
60+
if: ${{ steps.cache-gitstream.outputs.cache-hit != 'true' }}
6161
with:
6262
repository: ${{ inputs.full_repository }}
6363
ref: ${{ github.event.inputs.head_ref }}
6464
path: 'gitstream/repo/'
6565
token: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).githubToken || github.token }}
66-
66+
6767
- run: |
6868
all=2147483647
6969
cd gitstream
@@ -74,18 +74,7 @@ runs:
7474
git fetch --deepen=$all origin ${{ github.event.inputs.head_ref }}
7575
shell: bash
7676
if: ${{ steps.cache-gitstream.outputs.cache-hit != 'true' }}
77-
78-
- run: |
79-
cd gitstream
80-
cd repo
81-
git fetch origin ${{ github.event.inputs.base_ref }}
82-
git checkout ${{ github.event.inputs.head_ref }}
83-
git stash
84-
git pull origin ${{ github.event.inputs.head_ref }}
85-
shell: bash
86-
## this step will NOT run when cache exists
87-
if: ${{ steps.cache-gitstream.outputs.cache-hit == 'true' }}
88-
77+
8978
- name: Create cm folder
9079
## this step will be skipped if cache exists
9180
if: ${{ steps.cache-gitstream.outputs.cache-hit != 'true' }}
@@ -94,7 +83,7 @@ runs:
9483
run: |
9584
cd gitstream
9685
mkdir cm
97-
86+
9887
- name: Checkout cm repo
9988
uses: actions/checkout@v3
10089
## this step will be skipped if cache exists AND has cm repo
@@ -103,7 +92,7 @@ runs:
10392
repository: '${{ fromJSON(fromJSON(github.event.inputs.client_payload)).owner }}/${{ fromJSON(fromJSON(github.event.inputs.client_payload)).cmRepo }}'
10493
ref: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).cmRepoRef }}
10594
path: 'gitstream/cm/'
106-
95+
10796
- name: Run The Action
10897
id: gitstream-action
10998
if: always()

0 commit comments

Comments
 (0)