-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
63 lines (58 loc) · 2.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const core = require('@actions/core');
const github = require('@actions/github');
const { DefaultAzureCredential } = require('@azure/identity');
try {
// `who-to-greet` input defined in action metadata file
const nameToGreet = core.getInput('who-to-greet');
console.log(`Hello1 ${nameToGreet}!`);
console.log(`Hello2 ${nameToGreet}!`);
console.log('-----------(-1)');
// Delay to ensure all logs are processed
const accountName = core.getInput('azure-storage-account-name');
// process.env.AZURE_STORAGE_ACCOUNT_NAME;
console.log('----------- 0');
if (!accountName) throw Error('Azure Storage accountName not found');
// console.log('----1');
//
// const blobServiceClient = new BlobServiceClient(
// `https://${accountName}.blob.core.windows.net`,
// new DefaultAzureCredential()
// );
//
// console.log('----2');
//
// const containerName = core.getInput('azure-storage-container-name'); // 'quickstart';
// console.log('----3');
// const containerClient = blobServiceClient.getContainerClient(containerName);
// console.log('----4');
//
// // Create a unique name for the blob
// const blobName = 'quickstart.txt';
// console.log('----5');
//
// // Get a block blob client
// const blockBlobClient = containerClient.getBlockBlobClient(blobName);
// console.log('----6');
//
// // Display blob name and url
// console.log(
// `\nUploading to Azure storage as blob\n\tname: ${blobName}:\n\tURL: ${blockBlobClient.url}`
// );
//
// console.log('----7');
//
// // Upload data to the blob
// const data = 'Hello, World!';
// console.log('----8');
// const uploadBlobResponse = await blockBlobClient.upload(data, data.length);
// console.log(
// `Blob was uploaded successfully. requestId: ${uploadBlobResponse.requestId}`
// );
const time = (new Date()).toTimeString();
core.setOutput("time", time);
// Get the JSON webhook payload for the event that triggered the workflow
const payload = JSON.stringify(github.context.payload, undefined, 2)
console.log(`The event payload: ${payload}`);
} catch (error) {
core.setFailed(error.message);
}