Skip to content

Commit

Permalink
Revert "Refresh Tugboat Preview ID cache from PR cache scope (#16562)"
Browse files Browse the repository at this point in the history
This reverts commit 48de27e.
  • Loading branch information
JunTaoLuo committed Feb 2, 2024
1 parent 76ff483 commit 75cef86
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 38 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/tugboat-refresh-cache-responder.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ on:
- cron: '0 */6 * * *'
jobs:
# Collects the cache keys that need to be refreshed
dispatch_cache_keys:
name: Dispatch Tugboat Preview ID cache keys that need to be refreshed
collect_cache_keys:
name: Collect Tugboat Preview ID cache keys that need to be refreshed
outputs:
matrix: ${{ steps.cache-keys.outputs.result }}
runs-on: ubuntu-latest
steps:
- name: Cross reference open PRs against cache keys in repo
id: cache-keys
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
github-token: ${{ secrets.LABEL_API_TOKEN }}
script: |
const prs = await github.paginate(
github.rest.pulls.list,
Expand Down Expand Up @@ -41,14 +43,32 @@ jobs:
console.log(`Key: ${key}`)
}
const toRefresh = []
for (const pr of prs) {
if (cacheKeys.includes(`${{ runner.os }}-tugboat-preview-id-pr-${pr}`)) {
console.log(`Need to refresh: ${pr}`)
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: `${pr}`,
labels: ['refresh-tugboat-cache'],
});
toRefresh.push(pr)
}
}
const result = JSON.stringify(toRefresh)
console.log(`Refresh Keys: ${result}`)
return result
result-encoding: string

# Refresh cache for given keys
refresh_cache:
name: Refresh cache for given keys
needs: [ collect_cache_keys ]
runs-on: ubuntu-latest
strategy:
matrix:
value: ${{fromJSON(needs.collect_cache_keys.outputs.matrix)}}
steps:
- name: Refresh Preview ID
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: .tugboat_preview.txt
key: ${{ runner.os }}-tugboat-preview-id-pr-${{ matrix.value }}
- name: Cleanup temporary file
run: rm .tugboat_preview.txt

0 comments on commit 75cef86

Please sign in to comment.