0

在以下工作流程中,我想添加缓存功能,以便每次从头开始构建。这是工作流程:

# This workflow will do
# a clean install of node deps
# build the source code
# run test across different versions of node

name: Conflict Check
on:
  push:
    branches:
      - staging
  pull_request:
    branches:
      - staging

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
      - uses: mschilde/auto-label-merge-conflicts@master
        with:
          CONFLICT_LABEL_NAME: 'has conflicts'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

我怎样才能做到这一点?

4

1 回答 1

0

您可以使用操作/缓存操作在 Github 操作中进行缓存。

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
      - name: Cache build files
        uses: actions/cache@v2
        with:
          path: ${{ PATH_TO_CACHE }}
          key:${{ runner.os }}-${{ hashFiles(<glob_pattern_for_files>) }}
      - uses: mschilde/auto-label-merge-conflicts@master
        with:
          CONFLICT_LABEL_NAME: 'has conflicts'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

上面的示例假设您希望在不同的运行之间缓存文件,refs但您的实际密钥声明将取决于您要执行的操作。

例如,如果您尝试在同一 ref 上运行的作业或工作流之间进行缓存:

key: ${{ runner.os }}-${{ github.sha }}
于 2021-02-13T21:26:15.593 回答