Skip to content

Commit b20a661

Browse files
authored
feat: correção do workflow (#134)
2 parents 76f387a + 6cfabf8 commit b20a661

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/block-master-pr.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)