forked from seoklab/design-test
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (64 loc) · 2.57 KB
/
remove_problem.yml
File metadata and controls
81 lines (64 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Remove Problem
on:
issues:
types: [labeled]
jobs:
remove-problem:
if: contains(github.event.issue.labels.*.name, 'remove-problem')
runs-on: [self-hosted, galaxy4]
permissions:
contents: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Parse and remove problem
env:
ISSUE_BODY: ${{ github.event.issue.body }}
run: |
python3 scripts/parse_remove_problem.py \
--issue-body "$ISSUE_BODY" \
--issue-number ${{ github.event.issue.number }} \
--config docs/targets/config.json
- name: Regenerate leaderboard
run: |
python3 scripts/update_leaderboard.py \
--results-dir docs/results \
--config docs/targets/config.json \
--output docs/leaderboard_data.json
- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/targets/config.json docs/leaderboard_data.json
git commit -m "Remove ${PROBLEM_ID} from session ${SESSION_KEY}"
for i in 1 2 3; do
if git push; then
echo "Push succeeded on attempt $i"
break
fi
echo "Push failed on attempt $i, rebasing..."
git pull --rebase
done
- name: Comment confirmation on issue
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BODY="## Problem Removed
| Field | Value |
|-------|-------|
| **Problem ID** | \`${PROBLEM_ID}\` |
| **Session** | \`${SESSION_KEY}\` |
The problem has been removed from the session and will no longer appear on the submit or leaderboard pages.
The problem entry and PDB file are preserved — it can be re-added later."
gh issue comment ${{ github.event.issue.number }} --body "$BODY"
- name: Comment failure on issue
if: failure()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue comment ${{ github.event.issue.number }} --body "## Problem Removal Failed
There was an error removing this problem. Please check the issue body format and try again.
See the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details."
gh issue edit ${{ github.event.issue.number }} --add-label "error"