Skip to content

Commit 6781ce1

Browse files
committed
B
1 parent 4ddedae commit 6781ce1

File tree

2 files changed

+32
-48
lines changed

2 files changed

+32
-48
lines changed

dist/index.js

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -754927,33 +754927,25 @@ const cleanUp = () => {
754927754927
}
754928754928
};
754929754929

754930-
try {
754931-
if (action === 'push') {
754932-
pushMain().then(() => {
754933-
cleanUp();
754934-
}).catch((error) => {
754935-
core.setFailed(`Action failed with error: ${error.message}`);
754936-
cleanUp();
754937-
process.exit(1);
754938-
});
754939-
} else if (action === 'pull') {
754940-
pullMain().then(() => {
754941-
cleanUp();
754942-
}).catch((error) => {
754943-
core.setFailed(`Action failed with error: ${error.message}`);
754944-
cleanUp();
754930+
const runAction = async () => {
754931+
try {
754932+
if (action === 'push') {
754933+
await pushMain();
754934+
} else if (action === 'pull') {
754935+
await pullMain();
754936+
} else {
754937+
core.setFailed(`Unknown action: ${action}`);
754945754938
process.exit(1);
754946-
});
754947-
} else {
754948-
core.setFailed(`Unknown action: ${action}`);
754949-
cleanUp();
754939+
}
754940+
} catch (error) {
754941+
core.setFailed(`Action failed with error: ${error.message}`);
754950754942
process.exit(1);
754943+
} finally {
754944+
cleanUp();
754951754945
}
754952-
} catch (error) {
754953-
core.setFailed(`Action failed with error: ${error.message}`);
754954-
cleanUp();
754955-
process.exit(1);
754956-
}
754946+
};
754947+
754948+
runAction();
754957754949

754958754950
module.exports = __webpack_exports__;
754959754951
/******/ })()

entrypoint.js

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,22 @@ const cleanUp = () => {
6464
}
6565
};
6666

67-
try {
68-
if (action === 'push') {
69-
pushMain().then(() => {
70-
cleanUp();
71-
}).catch((error) => {
72-
core.setFailed(`Action failed with error: ${error.message}`);
73-
cleanUp();
74-
process.exit(1);
75-
});
76-
} else if (action === 'pull') {
77-
pullMain().then(() => {
78-
cleanUp();
79-
}).catch((error) => {
80-
core.setFailed(`Action failed with error: ${error.message}`);
81-
cleanUp();
67+
const runAction = async () => {
68+
try {
69+
if (action === 'push') {
70+
await pushMain();
71+
} else if (action === 'pull') {
72+
await pullMain();
73+
} else {
74+
core.setFailed(`Unknown action: ${action}`);
8275
process.exit(1);
83-
});
84-
} else {
85-
core.setFailed(`Unknown action: ${action}`);
86-
cleanUp();
76+
}
77+
} catch (error) {
78+
core.setFailed(`Action failed with error: ${error.message}`);
8779
process.exit(1);
80+
} finally {
81+
cleanUp();
8882
}
89-
} catch (error) {
90-
core.setFailed(`Action failed with error: ${error.message}`);
91-
cleanUp();
92-
process.exit(1);
93-
}
83+
};
84+
85+
runAction();

0 commit comments

Comments
 (0)