Skip to content

Commit

Permalink
Merge pull request #9330 from jimchamp/9250/feature/cache-octokit
Browse files Browse the repository at this point in the history
Cache `octokit` in GitHub workflows
  • Loading branch information
mekarpeles authored May 24, 2024
2 parents 5a2cd09 + a426ce2 commit ab0d7a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/new_pr_labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
pull_request_target:
types:
- opened
env:
NODE_VERSION: '20'
jobs:
label_pr:
# Continue only if the PR is not a draft, and was opened in the same repository that is running this action:
Expand All @@ -16,8 +18,15 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install @octokit/action
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v4
id: cache-octokit
with:
path: 'node_modules'
# Cache key shared across workflows
key: ${{ runner.os }}-node${{ env.NODE_VERSION}}-octokit-${{ hashFiles('**/package-lock.json') }}
- if: steps.cache-octokit.outputs.cache-hit != 'true'
run: npm install @octokit/action
- run: node scripts/gh_scripts/new_pr_labeler.mjs ${{ github.repository }} ${{ github.event.pull_request.user.login }} ${{ github.event.pull_request.number }} "$PR_BODY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/stale_assignee_digest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
workflow_dispatch:
permissions:
contents: read

env:
NODE_VERSION: '20'
jobs:
stale_assignee_digest:
if: ${{ github.repository == 'internetarchive/openlibrary'}}
Expand All @@ -14,8 +15,15 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install @octokit/action
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v4
id: cache-octokit
with:
path: 'node_modules'
# Cache key shared across workflows
key: ${{ runner.os }}-node${{ env.NODE_VERSION}}-octokit-${{ hashFiles('**/package-lock.json') }}
- if: steps.cache-octokit.outputs.cache-hit != 'true'
run: npm install @octokit/action
- run: node scripts/gh_scripts/stale_assignee_digest.mjs --repoOwner "internetarchive" --daysSince 14
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit ab0d7a6

Please sign in to comment.