Skip to content

Commit 19c3c72

Browse files
authored
cache results (#38)
1 parent 33597e4 commit 19c3c72

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

action.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,24 @@ runs:
4040
mkdir gitstream
4141
cd gitstream
4242
mkdir repo
43+
44+
- name: Cache gitstream results
45+
id: cache-gitstream-results
46+
uses: actions/cache@v3
47+
with:
48+
path: gitstream/cache.json
49+
key: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).headSha }}-gitsream-cache
50+
4351
- name: Checkout head branch
4452
uses: actions/checkout@v3
53+
if: ${{ steps.cache-gitstream-results.outputs.cache-hit != 'true' }}
4554
with:
4655
repository: ${{ inputs.full_repository }}
4756
ref: ${{ github.event.inputs.head_ref }}
4857
path: 'gitstream/repo/'
4958
token: ${{ fromJSON(fromJSON(github.event.inputs.client_payload)).githubToken || github.token }}
50-
- run: |
59+
- if: ${{ steps.cache-gitstream-results.outputs.cache-hit != 'true' }}
60+
run: |
5161
all=2147483647
5262
cd gitstream
5363
cd repo
@@ -77,7 +87,7 @@ runs:
7787
docker pull gitstream/rules-engine:latest
7888
echo "docker-pull-duration=$SECONDS" >> $GITHUB_OUTPUT
7989
SECONDS=0
80-
docker run -v $(pwd)/gitstream:/code -e HEAD_REF=${{ github.event.inputs.head_ref }} -e BASE_REF=${{ github.event.inputs.base_ref }} -e CLIENT_PAYLOAD=${{ github.event.inputs.client_payload }} -e RULES_RESOLVER_URL=${{ github.event.inputs.resolver_url }} -e RULES_RESOLVER_TOKEN=${{ github.event.inputs.resolver_token }} -e DEBUG_MODE=${{ github.event.inputs.debug_mode }} gitstream/rules-engine
90+
docker run -v $(pwd)/gitstream:/code -e USE_CACHE=${{ steps.cache-gitstream-results.outputs.cache-hit }} -e HEAD_REF=${{ github.event.inputs.head_ref }} -e BASE_REF=${{ github.event.inputs.base_ref }} -e CLIENT_PAYLOAD=${{ github.event.inputs.client_payload }} -e RULES_RESOLVER_URL=${{ github.event.inputs.resolver_url }} -e RULES_RESOLVER_TOKEN=${{ github.event.inputs.resolver_token }} -e DEBUG_MODE=${{ github.event.inputs.debug_mode }} gitstream/rules-engine
8191
echo "docker-run-duration=$SECONDS" >> $GITHUB_OUTPUT
8292
echo "action-run-duration=$(($EPOCHSECONDS - ${{ steps.start.outputs.timestamp }}))" >> $GITHUB_OUTPUT
83-
shell: bash
93+
shell: bash

0 commit comments

Comments
 (0)