Skip to content

Commit

Permalink
[bot] Update dist directory
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz authored and github-actions[bot] committed Jul 15, 2024
1 parent ff865cb commit d9c87d4
Show file tree
Hide file tree
Showing 6 changed files with 213 additions and 165 deletions.
124 changes: 70 additions & 54 deletions dist/dependency-submission/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144724,25 +144724,88 @@ async function complete(config) {
return;
case configuration_1.DependencyGraphOption.GenerateAndSubmit:
case configuration_1.DependencyGraphOption.Clear:
await submitDependencyGraphs(await findDependencyGraphFiles());
await findAndSubmitDependencyGraphs(config);
return;
case configuration_1.DependencyGraphOption.GenerateAndUpload:
await uploadDependencyGraphs(await findDependencyGraphFiles(), config);
await findAndUploadDependencyGraphs(config);
}
}
catch (e) {
warnOrFail(config, option, e);
}
}
exports.complete = complete;
async function uploadDependencyGraphs(dependencyGraphFiles, config) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to upload.');
async function downloadAndSubmitDependencyGraphs(config) {
if (isRunningInActEnvironment()) {
core.info('Dependency graph not supported in the ACT environment.');
return;
}
try {
await submitDependencyGraphs(await downloadDependencyGraphs());
}
catch (e) {
warnOrFail(config, configuration_1.DependencyGraphOption.DownloadAndSubmit, e);
}
}
async function findAndSubmitDependencyGraphs(config) {
if (isRunningInActEnvironment()) {
core.info('Dependency graph not supported in the ACT environment.');
return;
}
const dependencyGraphFiles = await findDependencyGraphFiles();
try {
await submitDependencyGraphs(dependencyGraphFiles);
}
catch (e) {
try {
await uploadDependencyGraphs(dependencyGraphFiles, config);
}
catch (uploadError) {
core.info(String(uploadError));
}
throw e;
}
}
async function findAndUploadDependencyGraphs(config) {
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload not supported in the ACT environment.');
core.info(`Would upload: ${dependencyGraphFiles.join(', ')}`);
core.info('Dependency graph not supported in the ACT environment.');
return;
}
await uploadDependencyGraphs(await findDependencyGraphFiles(), config);
}
async function downloadDependencyGraphs() {
const findBy = github.context.payload.workflow_run
? {
token: (0, configuration_1.getGithubToken)(),
workflowRunId: github.context.payload.workflow_run.id,
repositoryName: github.context.repo.repo,
repositoryOwner: github.context.repo.owner
}
: undefined;
const artifactClient = new artifact_1.DefaultArtifactClient();
const dependencyGraphArtifacts = (await artifactClient.listArtifacts({
latest: true,
findBy
})).artifacts.filter(artifact => artifact.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
for (const artifact of dependencyGraphArtifacts) {
const downloadedArtifact = await artifactClient.downloadArtifact(artifact.id, {
findBy
});
core.info(`Downloading dependency-graph artifact ${artifact.name} to ${downloadedArtifact.downloadPath}`);
}
return findDependencyGraphFiles();
}
async function findDependencyGraphFiles() {
const globber = await glob.create(`${getReportDirectory()}/**/*.json`);
const allFiles = await globber.glob();
const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
core.info(`Found dependency graph files: ${unprocessedFiles.join(', ')}`);
return unprocessedFiles;
}
async function uploadDependencyGraphs(dependencyGraphFiles, config) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to upload.');
return;
}
const workspaceDirectory = (0, configuration_1.getWorkspaceDirectory)();
Expand All @@ -144756,28 +144819,11 @@ async function uploadDependencyGraphs(dependencyGraphFiles, config) {
});
}
}
async function downloadAndSubmitDependencyGraphs(config) {
if (isRunningInActEnvironment()) {
core.info('Dependency graph download and submit not supported in the ACT environment.');
return;
}
try {
await submitDependencyGraphs(await downloadDependencyGraphs());
}
catch (e) {
warnOrFail(config, configuration_1.DependencyGraphOption.DownloadAndSubmit, e);
}
}
async function submitDependencyGraphs(dependencyGraphFiles) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to submit.');
return;
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph submit not supported in the ACT environment.');
core.info(`Would submit: ${dependencyGraphFiles.join(', ')}`);
return;
}
for (const dependencyGraphFile of dependencyGraphFiles) {
try {
await submitDependencyGraphFile(dependencyGraphFile);
Expand Down Expand Up @@ -144811,36 +144857,6 @@ async function submitDependencyGraphFile(jsonFile) {
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile);
core.notice(`Submitted ${relativeJsonFile}: ${response.data.message}`);
}
async function downloadDependencyGraphs() {
const findBy = github.context.payload.workflow_run
? {
token: (0, configuration_1.getGithubToken)(),
workflowRunId: github.context.payload.workflow_run.id,
repositoryName: github.context.repo.repo,
repositoryOwner: github.context.repo.owner
}
: undefined;
const artifactClient = new artifact_1.DefaultArtifactClient();
const dependencyGraphArtifacts = (await artifactClient.listArtifacts({
latest: true,
findBy
})).artifacts.filter(artifact => artifact.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
for (const artifact of dependencyGraphArtifacts) {
const downloadedArtifact = await artifactClient.downloadArtifact(artifact.id, {
findBy
});
core.info(`Downloading dependency-graph artifact ${artifact.name} to ${downloadedArtifact.downloadPath}`);
}
return findDependencyGraphFiles();
}
async function findDependencyGraphFiles() {
const globber = await glob.create(`${getReportDirectory()}/**/*.json`);
const allFiles = await globber.glob();
const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
core.info(`Found dependency graph files: ${unprocessedFiles.join(', ')}`);
return unprocessedFiles;
}
function getReportDirectory() {
return process.env.DEPENDENCY_GRAPH_REPORT_DIR;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/dependency-submission/main/index.js.map

Large diffs are not rendered by default.

124 changes: 70 additions & 54 deletions dist/setup-gradle/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144724,25 +144724,88 @@ async function complete(config) {
return;
case configuration_1.DependencyGraphOption.GenerateAndSubmit:
case configuration_1.DependencyGraphOption.Clear:
await submitDependencyGraphs(await findDependencyGraphFiles());
await findAndSubmitDependencyGraphs(config);
return;
case configuration_1.DependencyGraphOption.GenerateAndUpload:
await uploadDependencyGraphs(await findDependencyGraphFiles(), config);
await findAndUploadDependencyGraphs(config);
}
}
catch (e) {
warnOrFail(config, option, e);
}
}
exports.complete = complete;
async function uploadDependencyGraphs(dependencyGraphFiles, config) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to upload.');
async function downloadAndSubmitDependencyGraphs(config) {
if (isRunningInActEnvironment()) {
core.info('Dependency graph not supported in the ACT environment.');
return;
}
try {
await submitDependencyGraphs(await downloadDependencyGraphs());
}
catch (e) {
warnOrFail(config, configuration_1.DependencyGraphOption.DownloadAndSubmit, e);
}
}
async function findAndSubmitDependencyGraphs(config) {
if (isRunningInActEnvironment()) {
core.info('Dependency graph not supported in the ACT environment.');
return;
}
const dependencyGraphFiles = await findDependencyGraphFiles();
try {
await submitDependencyGraphs(dependencyGraphFiles);
}
catch (e) {
try {
await uploadDependencyGraphs(dependencyGraphFiles, config);
}
catch (uploadError) {
core.info(String(uploadError));
}
throw e;
}
}
async function findAndUploadDependencyGraphs(config) {
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload not supported in the ACT environment.');
core.info(`Would upload: ${dependencyGraphFiles.join(', ')}`);
core.info('Dependency graph not supported in the ACT environment.');
return;
}
await uploadDependencyGraphs(await findDependencyGraphFiles(), config);
}
async function downloadDependencyGraphs() {
const findBy = github.context.payload.workflow_run
? {
token: (0, configuration_1.getGithubToken)(),
workflowRunId: github.context.payload.workflow_run.id,
repositoryName: github.context.repo.repo,
repositoryOwner: github.context.repo.owner
}
: undefined;
const artifactClient = new artifact_1.DefaultArtifactClient();
const dependencyGraphArtifacts = (await artifactClient.listArtifacts({
latest: true,
findBy
})).artifacts.filter(artifact => artifact.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
for (const artifact of dependencyGraphArtifacts) {
const downloadedArtifact = await artifactClient.downloadArtifact(artifact.id, {
findBy
});
core.info(`Downloading dependency-graph artifact ${artifact.name} to ${downloadedArtifact.downloadPath}`);
}
return findDependencyGraphFiles();
}
async function findDependencyGraphFiles() {
const globber = await glob.create(`${getReportDirectory()}/**/*.json`);
const allFiles = await globber.glob();
const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
core.info(`Found dependency graph files: ${unprocessedFiles.join(', ')}`);
return unprocessedFiles;
}
async function uploadDependencyGraphs(dependencyGraphFiles, config) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to upload.');
return;
}
const workspaceDirectory = (0, configuration_1.getWorkspaceDirectory)();
Expand All @@ -144756,28 +144819,11 @@ async function uploadDependencyGraphs(dependencyGraphFiles, config) {
});
}
}
async function downloadAndSubmitDependencyGraphs(config) {
if (isRunningInActEnvironment()) {
core.info('Dependency graph download and submit not supported in the ACT environment.');
return;
}
try {
await submitDependencyGraphs(await downloadDependencyGraphs());
}
catch (e) {
warnOrFail(config, configuration_1.DependencyGraphOption.DownloadAndSubmit, e);
}
}
async function submitDependencyGraphs(dependencyGraphFiles) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to submit.');
return;
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph submit not supported in the ACT environment.');
core.info(`Would submit: ${dependencyGraphFiles.join(', ')}`);
return;
}
for (const dependencyGraphFile of dependencyGraphFiles) {
try {
await submitDependencyGraphFile(dependencyGraphFile);
Expand Down Expand Up @@ -144811,36 +144857,6 @@ async function submitDependencyGraphFile(jsonFile) {
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile);
core.notice(`Submitted ${relativeJsonFile}: ${response.data.message}`);
}
async function downloadDependencyGraphs() {
const findBy = github.context.payload.workflow_run
? {
token: (0, configuration_1.getGithubToken)(),
workflowRunId: github.context.payload.workflow_run.id,
repositoryName: github.context.repo.repo,
repositoryOwner: github.context.repo.owner
}
: undefined;
const artifactClient = new artifact_1.DefaultArtifactClient();
const dependencyGraphArtifacts = (await artifactClient.listArtifacts({
latest: true,
findBy
})).artifacts.filter(artifact => artifact.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
for (const artifact of dependencyGraphArtifacts) {
const downloadedArtifact = await artifactClient.downloadArtifact(artifact.id, {
findBy
});
core.info(`Downloading dependency-graph artifact ${artifact.name} to ${downloadedArtifact.downloadPath}`);
}
return findDependencyGraphFiles();
}
async function findDependencyGraphFiles() {
const globber = await glob.create(`${getReportDirectory()}/**/*.json`);
const allFiles = await globber.glob();
const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
core.info(`Found dependency graph files: ${unprocessedFiles.join(', ')}`);
return unprocessedFiles;
}
function getReportDirectory() {
return process.env.DEPENDENCY_GRAPH_REPORT_DIR;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/setup-gradle/main/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit d9c87d4

Please sign in to comment.