mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-22 16:53:57 +08:00
Support AWS S3 and compatible software
This commit is contained in:
parent
72d1e4fdff
commit
3922a6a550
10 changed files with 122536 additions and 26393 deletions
|
@ -1,6 +1,8 @@
|
|||
import * as core from "@actions/core";
|
||||
|
||||
import { Outputs, RefKey, State } from "../constants";
|
||||
import { Inputs, Outputs, RefKey, State } from "../constants";
|
||||
|
||||
import {CommonPrefix, InputSerialization, S3ClientConfig} from "@aws-sdk/client-s3";
|
||||
|
||||
export function isGhes(): boolean {
|
||||
const ghUrl = new URL(
|
||||
|
@ -74,3 +76,25 @@ export function getInputAsInt(
|
|||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
export function getInputS3ClientConfig(): S3ClientConfig | undefined {
|
||||
const s3BucketName = core.getInput(Inputs.AWSS3Bucket)
|
||||
if (!s3BucketName) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const s3config = {
|
||||
credentials: {
|
||||
accessKeyId: core.getInput(Inputs.AWSAccessKeyId),
|
||||
secretAccessKey: core.getInput(Inputs.AWSSecretAccessKey)
|
||||
},
|
||||
region: core.getInput(Inputs.AWSRegion),
|
||||
endpoint: core.getInput(Inputs.AWSEndpoint),
|
||||
bucketEndpoint: core.getBooleanInput(Inputs.AWSS3BucketEndpoint),
|
||||
forcePathStyle: core.getBooleanInput(Inputs.AWSS3ForcePathStyle),
|
||||
} as S3ClientConfig
|
||||
|
||||
core.debug('Enable S3 backend mode.')
|
||||
|
||||
return s3config
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue