@@ -29964,38 +29964,40 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
2996429964const core = __importStar(__nccwpck_require__(7484));
2996529965const github = __importStar(__nccwpck_require__(3228));
2996629966async function run() {
29967+ var _a;
2996729968 try {
29968- // 1. Obtém o token do GitHub
29969+ // Inputs
2996929970 const githubToken = core.getInput('github-token', { required: true });
29970- // 2. Cria uma instância do cliente Octokit (para interagir com a API)
29971- const octokit = github.getOctokit(githubToken);
29972- // 3. Obtém os inputs da action
29973- const title = core.getInput('title', { required: true });
29974- const body = core.getInput('body', { required: false });
29975- const head = core.getInput('source-branch', { required: true });
29976- const base = core.getInput('dest-branch', { required: true });
29977- // 4. Obtém informações do repositório
29971+ const title = core.getInput('title', { required: true }).trim();
29972+ const body = ((_a = core.getInput('body', { required: false })) === null || _a === void 0 ? void 0 : _a.trim()) || undefined;
29973+ const sourceBranch = core.getInput('source-branch', { required: true }).trim();
29974+ const destBranch = core.getInput('dest-branch', { required: true }).trim();
29975+ // Repo context
2997829976 const { owner, repo } = github.context.repo;
29979- // 5. Cria o Pull Request
29977+ const octokit = github.getOctokit(githubToken);
29978+ core.info(`Creating pull request from '${sourceBranch}' to '${destBranch}' in ${owner}/${repo}`);
29979+ // Create PR
2998029980 const { data: pullRequest } = await octokit.rest.pulls.create({
2998129981 owner,
2998229982 repo,
2998329983 title,
29984- head,
29985- base,
29986- body
29984+ head: sourceBranch ,
29985+ base: destBranch ,
29986+ body,
2998729987 });
29988- console.log(`Created Pull Request: ${pullRequest.html_url}`);
29989- // 6. Define o output para uso em actions futuras
29988+ core.info(`Created Pull Request: ${pullRequest.html_url}`);
2999029989 core.setOutput('pull-request-url', pullRequest.html_url);
2999129990 }
2999229991 catch (error) {
2999329992 if (error instanceof Error) {
29994- core.setFailed(error.message);
29993+ core.setFailed(`Action failed with error: ${error.message}`);
29994+ }
29995+ else {
29996+ core.setFailed('Action failed with unknown error.');
2999529997 }
2999629998 }
2999729999}
29998- run();
30000+ void run();
2999930001
3000030002
3000130003/***/ }),
0 commit comments