Skip to content

Commit

Permalink
Cache per branch (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShakedZrihen authored Apr 2, 2023
1 parent 2e71de8 commit 0a7a0f9
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ runs:
uses: actions/cache@v3
with:
path: gitstream
key: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).repo }}-gitsream-cache
key: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).repo }}-${{ github.event.inputs.head_ref }}-gitsream-cache

- name: Create GitStream folder
## this step will be skipped if cache exists
Expand Down Expand Up @@ -75,17 +75,28 @@ runs:
shell: bash
if: ${{ steps.cache-gitstream.outputs.cache-hit != 'true' }}
- name: Configure Git
- name: Update repo cache state
shell: bash
env:
GITHUB_TOKEN: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).githubToken || github.token }}
run: |
cd gitstream
cd repo
git stash
gh pr checkout ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).pullRequestNumber }}
cd gitstream && cd repo
git add . && git stash
git checkout ${{ github.event.inputs.base_ref }}
git add . && git stash && gh repo sync --force
git checkout ${{ github.event.inputs.head_ref }}
git add . && git stash && gh repo sync --force
if: ${{ steps.cache-gitstream.outputs.cache-hit == 'true' }}

- name: Update cm cache state
shell: bash
env:
GITHUB_TOKEN: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).githubToken || github.token }}
run: |
cd gitstream && cd cm
git add . && git stash && gh repo sync --force
if: ${{ steps.cache-gitstream.outputs.cache-hit == 'true' && fromJSON(fromJSON(github.event.inputs.client_payload)).hasCmRepo == true }}

- name: Create cm folder
## this step will be skipped if cache exists
if: ${{ steps.cache-gitstream.outputs.cache-hit != 'true' }}
Expand Down

0 comments on commit 0a7a0f9

Please sign in to comment.