Skip to content

Use GITHUB_WORKFLOW to generate cache key - #15

Merged
milesj merged 1 commit into
moonrepo:masterfrom
mlga:cache-key-workflow
Nov 7, 2023
Merged

milesj merged 1 commit into
moonrepo:masterfrom
mlga:cache-key-workflow

Conversation

@mlga

@mlga mlga commented Nov 7, 2023

Copy link
Copy Markdown
Contributor

While utilizing "Reusable Workflows", using GITHUB_JOB env variable alone is not sufficient. Across all the child workflows which call a reusable workflow,GITHUB_JOB will contain the same name.

Since this pattern is often used in monorepos hosting multiple services or libraries with independent dependencies, cache should be generated per-workflow as well.

In typical use case of having completely separated workflow definitions, the cache is also guaranteed not to be shared across workflows (even if job ID is duplicated intentionally or by accident).

@milesj

milesj commented Nov 7, 2023

Copy link
Copy Markdown
Contributor

Good callout.

@milesj
milesj merged commit 9c00f9c into moonrepo:master Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants