mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
fix: enforce target branch workflow
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
name: Enforce PR Target Branch
|
name: Enforce PR Target Branch
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request_target:
|
||||||
types: [opened, reopened, edited, synchronize]
|
types: [opened, reopened, edited, synchronize]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -9,6 +9,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
issues: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Flag or clear wrong base branch
|
- name: Flag or clear wrong base branch
|
||||||
@@ -63,7 +65,8 @@ jobs:
|
|||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
name: 'wrong-base-branch',
|
name: 'wrong-base-branch',
|
||||||
});
|
});
|
||||||
} catch {
|
} catch (err) {
|
||||||
|
if (err.status === 404) {
|
||||||
await github.rest.issues.createLabel({
|
await github.rest.issues.createLabel({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
@@ -72,6 +75,7 @@ jobs:
|
|||||||
description: 'PR is targeting the wrong base branch',
|
description: 'PR is targeting the wrong base branch',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await github.rest.issues.addLabels({
|
await github.rest.issues.addLabels({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
|
|||||||
Reference in New Issue
Block a user