diff --git a/.github/workflows/new_pr_labeler.yml b/.github/workflows/new_pr_labeler.yml index 95604c5f122..6cba5874878 100644 --- a/.github/workflows/new_pr_labeler.yml +++ b/.github/workflows/new_pr_labeler.yml @@ -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: @@ -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 }} diff --git a/.github/workflows/stale_assignee_digest.yml b/.github/workflows/stale_assignee_digest.yml index a00ac0f780d..4e6e14ccc26 100644 --- a/.github/workflows/stale_assignee_digest.yml +++ b/.github/workflows/stale_assignee_digest.yml @@ -5,7 +5,8 @@ on: workflow_dispatch: permissions: contents: read - +env: + NODE_VERSION: '20' jobs: stale_assignee_digest: if: ${{ github.repository == 'internetarchive/openlibrary'}} @@ -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 }}