mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
Bumps [actions/github-script](https://github.com/actions/github-script) from 7.1.0 to 9.0.0. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v7.1.0...3a2844b7e9c422d3c10d287c895573f7108da1b3) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
68 lines
2.4 KiB
YAML
68 lines
2.4 KiB
YAML
name: "Sends notification when A/N BDU label is attached to PR"
|
|
|
|
on:
|
|
pull_request:
|
|
types: [labeled]
|
|
branches: [develop]
|
|
|
|
permissions:
|
|
pull-requests: read
|
|
issues: read
|
|
|
|
jobs:
|
|
notify-bdu:
|
|
name: Notify Teams when A/N BDU label is added
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
if: >-
|
|
github.event.action == 'labeled' &&
|
|
github.event.label.name == 'A/N BDU' &&
|
|
github.event.pull_request.state == 'open'
|
|
steps:
|
|
- name: Check if label was added after PR creation (with time threshold)
|
|
id: check_label_timing
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
with:
|
|
script: |
|
|
const prCreatedAt = new Date('${{ github.event.pull_request.created_at }}');
|
|
|
|
const timeline = await github.rest.issues.listEvents({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.issue.number,
|
|
});
|
|
|
|
const labelEvent = timeline.data.reverse().find(event =>
|
|
event.event === 'labeled' &&
|
|
event.label.name === 'A/N BDU'
|
|
);
|
|
|
|
if (!labelEvent) {
|
|
core.setOutput('should_notify', 'false');
|
|
return;
|
|
}
|
|
|
|
const labelAddedAt = new Date(labelEvent.created_at);
|
|
const timeDiffSeconds = (labelAddedAt - prCreatedAt) / 1000;
|
|
|
|
if (timeDiffSeconds > 15) {
|
|
core.setOutput('should_notify', 'true');
|
|
} else {
|
|
core.setOutput('should_notify', 'false');
|
|
}
|
|
|
|
- name: Send Teams notification
|
|
if: steps.check_label_timing.outputs.should_notify == 'true'
|
|
uses: Alfresco/alfresco-build-tools/.github/actions/send-teams-notification@98bcfbe06aafffdc0e9a790f352602316f82303b # v18.23.0
|
|
with:
|
|
webhook-url: ${{ secrets.TEAMS_NOTIFICATION_ADF_BDU_WEBHOOK }}
|
|
skip_checkout: true
|
|
status: success
|
|
title: "A/N BDU PR: ${{ github.event.pull_request.title }}"
|
|
message: |
|
|
A pull request has been marked with the **A/N BDU** label.
|
|
|
|
- **Repository:** ${{ github.repository }}
|
|
- **PR:** [#${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})
|
|
- **Author:** ${{ github.event.pull_request.user.login }}
|