11/******/ (() => { // webpackBootstrap
22/******/ var __webpack_modules__ = ({
33
4- /***/ 4822 :
4+ /***/ 9283 :
55/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
66
77"use strict";
@@ -36,19 +36,37 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
3636const core = __importStar(__nccwpck_require__(2186));
3737const github = __importStar(__nccwpck_require__(5438));
3838const axios_1 = __importDefault(__nccwpck_require__(8757));
39+ const fs = __importStar(__nccwpck_require__(7147));
40+ const path = __importStar(__nccwpck_require__(1017));
41+ const os = __importStar(__nccwpck_require__(2037));
3942async function run() {
4043 try {
4144 const baseUrl = core.getInput('base_url');
4245 const bbRunUuid = core.getInput('bb_run_uuid');
43- const steps = core.getInput('steps');
44- const token = core.getInput('token');
46+ const stepsInput = core.getInput('steps');
47+ const clientId = core.getInput('client_id');
48+ const keySecret = core.getInput('key_secret');
49+ // Parse the steps input
50+ const steps = JSON.parse(`[${stepsInput}]`);
51+ // Authenticate and get the token
52+ const authResponse = await axios_1.default.post(`${baseUrl}/api/login`, `grant_type=client_credentials&client_id=${clientId}&client_secret=${keySecret}`, {
53+ headers: {
54+ 'Content-Type': 'application/x-www-form-urlencoded'
55+ }
56+ });
57+ const token = authResponse.data.access_token;
58+ // Write token to a temporary file
59+ const tempDir = process.env.RUNNER_TEMP || os.tmpdir();
60+ const tokenFilePath = path.join(tempDir, 'meshstack_token.json');
61+ fs.writeFileSync(tokenFilePath, JSON.stringify({ token }));
62+ // Register the source
4563 const response = await axios_1.default.post(`${baseUrl}/api/meshobjects/meshbuildingblockruns/${bbRunUuid}/status/source`, {
4664 source: {
4765 id: 'github',
4866 externalRunId: github.context.runId,
4967 externalRunUrl: `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/actions/runs/${github.context.runId}`
5068 },
51- steps: JSON.parse( steps)
69+ steps: steps
5270 }, {
5371 headers: {
5472 'Content-Type': 'application/vnd.meshcloud.api.meshbuildingblockrun.v1.hal+json',
@@ -57,6 +75,7 @@ async function run() {
5775 }
5876 });
5977 core.setOutput('response', response.data);
78+ core.setOutput('token_file', tokenFilePath);
6079 }
6180 catch (error) {
6281 if (error instanceof Error) {
@@ -40206,7 +40225,7 @@ module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"
4020640225/******/ // startup
4020740226/******/ // Load entry module and return exports
4020840227/******/ // This entry module is referenced by other modules so it can't be inlined
40209- /******/ var __webpack_exports__ = __nccwpck_require__(4822 );
40228+ /******/ var __webpack_exports__ = __nccwpck_require__(9283 );
4021040229/******/ module.exports = __webpack_exports__;
4021140230/******/
4021240231/******/ })()
0 commit comments