File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,17 +10,26 @@ jobs:
1010 runs-on : ubuntu-latest
1111
1212 steps :
13- - name : Comment and close PR
13+ - name : Check source branch and block if not develop
1414 uses : actions/github-script@v7
1515 with :
1616 script : |
17+ const sourceBranch = context.payload.pull_request.head.ref;
18+
19+ if (sourceBranch === 'develop') {
20+ console.log(`✅ PR de ${sourceBranch} para master permitido.`);
21+ return;
22+ }
23+
1724 await github.rest.issues.createComment({
1825 owner: context.repo.owner,
1926 repo: context.repo.repo,
2027 issue_number: context.issue.number,
21- body: '❌ Pull Requests para master não são permitidos. Utilize a branch develop.'
28+ body: `❌ Pull Requests diretamente para **master** são permitidos apenas a partir da branch **develop**.
29+ Origem detectada: \`${sourceBranch}\`.
30+ Por favor, primeiro faça o merge da sua branch na \`develop\` e então abra um PR de \`develop\` para \`master\`.`
2231 });
23-
32+
2433 await github.rest.pulls.update({
2534 owner: context.repo.owner,
2635 repo: context.repo.repo,
You can’t perform that action at this time.
0 commit comments