Skip to content

Commit 0a7a0f9

Browse files
authored
Cache per branch (#35)
1 parent 2e71de8 commit 0a7a0f9

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

action.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ runs:
4141
uses: actions/cache@v3
4242
with:
4343
path: gitstream
44-
key: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).repo }}-gitsream-cache
44+
key: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).repo }}-${{ github.event.inputs.head_ref }}-gitsream-cache
4545

4646
- name: Create GitStream folder
4747
## this step will be skipped if cache exists
@@ -75,17 +75,28 @@ runs:
7575
shell: bash
7676
if: ${{ steps.cache-gitstream.outputs.cache-hit != 'true' }}
7777
78-
- name: Configure Git
78+
- name: Update repo cache state
7979
shell: bash
8080
env:
8181
GITHUB_TOKEN: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).githubToken || github.token }}
8282
run: |
83-
cd gitstream
84-
cd repo
85-
git stash
86-
gh pr checkout ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).pullRequestNumber }}
83+
cd gitstream && cd repo
84+
git add . && git stash
85+
git checkout ${{ github.event.inputs.base_ref }}
86+
git add . && git stash && gh repo sync --force
87+
git checkout ${{ github.event.inputs.head_ref }}
88+
git add . && git stash && gh repo sync --force
8789
if: ${{ steps.cache-gitstream.outputs.cache-hit == 'true' }}
8890

91+
- name: Update cm cache state
92+
shell: bash
93+
env:
94+
GITHUB_TOKEN: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).githubToken || github.token }}
95+
run: |
96+
cd gitstream && cd cm
97+
git add . && git stash && gh repo sync --force
98+
if: ${{ steps.cache-gitstream.outputs.cache-hit == 'true' && fromJSON(fromJSON(github.event.inputs.client_payload)).hasCmRepo == true }}
99+
89100
- name: Create cm folder
90101
## this step will be skipped if cache exists
91102
if: ${{ steps.cache-gitstream.outputs.cache-hit != 'true' }}

0 commit comments

Comments
 (0)