mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Stop PR in case of forbidden label (#8508)
* stop PR in case of forbidden label * sync PR * add tmp workflow * add tmp workflow * add tmp workflow * checkout repo
This commit is contained in:
26
.github/workflows/pull-request.yml
vendored
26
.github/workflows/pull-request.yml
vendored
@@ -449,6 +449,32 @@ jobs:
|
|||||||
apa-proxy: ${{ matrix.e2e-test.apa-proxy }}
|
apa-proxy: ${{ matrix.e2e-test.apa-proxy }}
|
||||||
deps: ${{ matrix.e2e-test.deps }}
|
deps: ${{ matrix.e2e-test.deps }}
|
||||||
|
|
||||||
|
PR-forbidden-labels:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- id: checkoutRepo
|
||||||
|
name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
- name: PR contains forbidden labels
|
||||||
|
id: pr-forbidden
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const issueHasLabels = require('./scripts/github/update/check-issue-has-label.js');
|
||||||
|
const checkLabels = ['next version ➡️', 'do not merge🙅🏻♂️'];
|
||||||
|
|
||||||
|
const hasLabel = await issueHasLabels({github, context, checkLabels})
|
||||||
|
|
||||||
|
if(hasLabel) {
|
||||||
|
core.setFailed('The PR contains a forbidden label! You are not allowed to merge until the label is there.');
|
||||||
|
}
|
||||||
|
- name: Check value after
|
||||||
|
run: |
|
||||||
|
echo "result ${{ toJson(steps.pr-forbidden.*.result) }}" && echo "result ${{ steps.pr-forbidden.*.result }}"
|
||||||
|
echo "result ${{ contains(toJson(steps.pr-forbidden.*.result), 'failure') }}"
|
||||||
|
|
||||||
finalize:
|
finalize:
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
14
scripts/github/update/check-issue-has-label.js
Executable file
14
scripts/github/update/check-issue-has-label.js
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
module.exports = async ({ github, context, checkLabels }) => {
|
||||||
|
const { data: issue } = await github.rest.issues.get({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
});
|
||||||
|
const labels = issue.labels?.map(item => item.name);
|
||||||
|
|
||||||
|
if (checkLabels.some(i => labels.includes(i))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user