mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-09-03 07:10:44 +02:00
120 lines
3.2 KiB
YAML
120 lines
3.2 KiB
YAML
# test branch
|
|
name: PR Edit Trigger
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- edited
|
|
- labeled
|
|
- unlabeled
|
|
|
|
permissions:
|
|
pull-requests: write
|
|
contents: read
|
|
|
|
jobs:
|
|
check-pr-trigger:
|
|
name: Check PR Trigger
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
require_validation: ${{ steps.check.outputs.require_validation }}
|
|
file_label_change: ${{ steps.check.outputs.file_label_change }}
|
|
|
|
steps:
|
|
- name: Check PR Trigger
|
|
id: check
|
|
uses: actions/github-script@v8
|
|
with:
|
|
script: |
|
|
core.setOutput('require_validation', 'true');
|
|
core.setOutput('file_label_change', 'false');
|
|
|
|
/*
|
|
* If triggered by label change, ignore unrelated labels.
|
|
*/
|
|
const action = context.payload.action;
|
|
if (action === 'labeled' || action === 'unlabeled') {
|
|
const changedLabel = context.payload.label?.name;
|
|
|
|
const relevantLabels = [
|
|
'Feature',
|
|
'Bug Fix',
|
|
'Infrastructure',
|
|
'Breaking API'
|
|
];
|
|
|
|
if (!relevantLabels.includes(changedLabel)) {
|
|
core.info(
|
|
`Ignoring unrelated label change: ${changedLabel}`
|
|
);
|
|
core.setOutput('require_validation', 'false');
|
|
}
|
|
|
|
const fileLabels = [
|
|
'File Major',
|
|
'File Minor',
|
|
];
|
|
|
|
if (fileLabels.includes(changedLabel)) {
|
|
core.info(
|
|
`File version label change detected: ${changedLabel}`
|
|
);
|
|
core.setOutput('file_label_change', 'true');
|
|
}
|
|
|
|
}
|
|
|
|
if (core.getOutput('require_validation') === 'true') {
|
|
core.info('PR type validation required.');
|
|
} else {
|
|
core.info('PR type validation not required.');
|
|
}
|
|
|
|
if (core.getOutput('file_label_change') === 'true') {
|
|
core.info('File version label change detected.');
|
|
} else {
|
|
core.info('No file version label change detected.');
|
|
}
|
|
|
|
validate-pr-type:
|
|
needs: check-pr-trigger
|
|
if: ${{ needs.check-pr-trigger.outputs.require_validation == 'true' }}
|
|
uses: ./.github/workflows/pr_type_validation.yaml
|
|
with:
|
|
pr_number: ${{ github.event.pull_request.number }}
|
|
permissions:
|
|
pull-requests: write
|
|
contents: read
|
|
|
|
milestone:
|
|
needs: validate-pr-type
|
|
uses: ./.github/workflows/pr_milestone.yaml
|
|
with:
|
|
pr_number: ${{ github.event.pull_request.number }}
|
|
permissions:
|
|
pull-requests: write
|
|
contents: read
|
|
|
|
detector-labels:
|
|
needs: validate-pr-type
|
|
uses: ./.github/workflows/pr_detector_labels.yaml
|
|
with:
|
|
pr_number: ${{ github.event.pull_request.number }}
|
|
permissions:
|
|
pull-requests: write
|
|
issues: read
|
|
|
|
file-version:
|
|
needs: check-pr-trigger
|
|
if: ${{ needs.check-pr-trigger.outputs.file_label_change == 'true' }}
|
|
uses: ./.github/workflows/pr_file_version.yaml
|
|
with:
|
|
pr_number: ${{ github.event.pull_request.number }}
|
|
permissions:
|
|
pull-requests: write
|
|
contents: read
|
|
|