Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions workflow-steps/cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,12 @@ base-branch: 'main' # or another branch
This will ensure that when you first open a PR, if a cached entry isn't found for the current branch, it will try to
look at entries
on your default protected branch (usually `main`).

## Cache writes and access token permissions

The cache step requires a **read-write** access token to write cache entries. If your CI access token only has **read**
permissions, cache restores will work normally but cache uploads will be skipped with a message indicating the
permissions issue.

This is expected in setups where PR workflows use read-only tokens for security — cache entries are written by
your main branch workflow (which uses a read-write token), and PR workflows only restore from that cache.
11 changes: 11 additions & 0 deletions workflow-steps/cache/generated_protos/cache_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ export class StoreResponse extends Message<StoreResponse> {
*/
skipped = false;

/**
* @generated from field: string skipped_message = 3;
*/
skippedMessage = '';

constructor(data?: PartialMessage<StoreResponse>) {
super();
proto3.util.initPartial(data, this);
Expand All @@ -220,6 +225,12 @@ export class StoreResponse extends Message<StoreResponse> {
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: 'success', kind: 'scalar', T: 8 /* ScalarType.BOOL */ },
{ no: 2, name: 'skipped', kind: 'scalar', T: 8 /* ScalarType.BOOL */ },
{
no: 3,
name: 'skipped_message',
kind: 'scalar',
T: 9 /* ScalarType.STRING */,
},
]);

static fromBinary(
Expand Down
10 changes: 10 additions & 0 deletions workflow-steps/cache/output/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3510,6 +3510,10 @@ var StoreResponse = class _StoreResponse extends Message {
* @generated from field: bool skipped = 2;
*/
skipped = false;
/**
* @generated from field: string skipped_message = 3;
*/
skippedMessage = "";
constructor(data) {
super();
proto3.util.initPartial(data, this);
Expand All @@ -3530,6 +3534,12 @@ var StoreResponse = class _StoreResponse extends Message {
kind: "scalar",
T: 8
/* ScalarType.BOOL */
},
{
no: 3,
name: "skipped_message",
kind: "scalar",
T: 9
}
]);
static fromBinary(bytes, options) {
Expand Down
13 changes: 12 additions & 1 deletion workflow-steps/cache/output/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -3498,6 +3498,10 @@ var StoreResponse = class _StoreResponse extends Message {
* @generated from field: bool skipped = 2;
*/
skipped = false;
/**
* @generated from field: string skipped_message = 3;
*/
skippedMessage = "";
constructor(data) {
super();
proto3.util.initPartial(data, this);
Expand All @@ -3518,6 +3522,12 @@ var StoreResponse = class _StoreResponse extends Message {
kind: "scalar",
T: 8
/* ScalarType.BOOL */
},
{
no: 3,
name: "skipped_message",
kind: "scalar",
T: 9
}
]);
static fromBinary(bytes, options) {
Expand Down Expand Up @@ -10289,7 +10299,8 @@ if (!!cacheWasHit) {
Successfully uploaded marked directories.`);
if (r.skipped)
console.log(
"\nSkipped storing to cache, another instance has already started the upload."
`
${r.skippedMessage || "Skipped storing to cache, another instance has already started the upload."}`
);
process.exit(0);
}).catch((err) => {
Expand Down
2 changes: 1 addition & 1 deletion workflow-steps/cache/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (!!cacheWasHit) {
if (r.success) console.log(`\nSuccessfully uploaded marked directories.`);
if (r.skipped)
console.log(
'\nSkipped storing to cache, another instance has already started the upload.',
`\n${r.skippedMessage || 'Skipped storing to cache, another instance has already started the upload.'}`,
);
process.exit(0);
})
Expand Down
Loading