Skip to content

Commit 2053ad3

Browse files
Copilotasmyasnikov
andauthored
Remove SLO label from PR after SLO workflow completes (#1961)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Aleksey Myasnikov <asmyasnikov@ydb.tech> Co-authored-by: asmyasnikov <14202262+asmyasnikov@users.noreply.github.com>
1 parent 3b9920c commit 2053ad3

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

.github/workflows/slo-report.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: slo-report
22

33
on:
44
workflow_run:
5-
workflows: ["slo"]
5+
workflows: ["SLO"]
66
types:
77
- completed
88

@@ -21,3 +21,37 @@ jobs:
2121
with:
2222
github_token: ${{ secrets.GITHUB_TOKEN }}
2323
github_run_id: ${{ github.event.workflow_run.id }}
24+
remove-slo-label:
25+
needs: test-ydb-slo-action
26+
if: always() && github.event.workflow_run.event == 'pull_request'
27+
runs-on: ubuntu-latest
28+
name: Remove SLO Label
29+
permissions:
30+
pull-requests: write
31+
steps:
32+
- name: Remove SLO label from PR
33+
uses: actions/github-script@v7
34+
with:
35+
script: |
36+
const pullRequests = context.payload.workflow_run.pull_requests;
37+
if (pullRequests && pullRequests.length > 0) {
38+
for (const pr of pullRequests) {
39+
try {
40+
await github.rest.issues.removeLabel({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
issue_number: pr.number,
44+
name: 'SLO'
45+
});
46+
console.log(`Removed SLO label from PR #${pr.number}`);
47+
} catch (error) {
48+
if (error.status === 404) {
49+
console.log(`SLO label not found on PR #${pr.number}, skipping`);
50+
} else {
51+
throw error;
52+
}
53+
}
54+
}
55+
} else {
56+
console.log('No pull requests associated with this workflow run');
57+
}

0 commit comments

Comments
 (0)