-
Notifications
You must be signed in to change notification settings - Fork 262
82 lines (80 loc) · 3.01 KB
/
bug.yml
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
82
name: Bug Solver
on:
issues:
types:
- labeled
jobs:
bug_solver:
if: github.event.label.name == 'solve-bug'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Close Issue
uses: peter-evans/close-issue@v3
with:
issue-number: ${{ github.event.issue.number }}
comment: Terima kasih atas kontribusi Anda, permintaan koreksi domain Anda akan segera diterapkan.
- name: Remove Domain
run: |
domain=$(jq -r '.issue.body' "$GITHUB_EVENT_PATH" | sed -n '3p')
sed "/$domain/d" releases/hosts > releases/hosts.tmp
rm releases/hosts
mv releases/hosts.tmp releases/hosts
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl unzip wget jq
curl -LO https://github.com/findomain/findomain/releases/latest/download/findomain-linux.zip
unzip findomain-linux.zip
chmod +x findomain
sudo mv findomain /usr/bin/findomain
wget https://raw.githubusercontent.com/bebasid/bebasid/master/dev/scripts/scan.py
echo "INSTALLATION DONE - ALL SET"
- name: Run Findomain
run: |
domain=$(jq -r '.issue.body' "$GITHUB_EVENT_PATH" | sed -n '3p')
findomain -t $domain -u hasilunsorted
- name: Sort Subdomains
run: |
python - <<EOF
with open('hasilunsorted', 'r') as file:
lines = [line.rstrip() for line in file.readlines()]
sorted_lines = sorted(lines, key=len)
sorted_content = "\n".join(sorted_lines)
with open('hasilsorted', 'w') as file:
file.write(sorted_content)
EOF
- name: Run Scan
run: |
python scan.py hasilsorted
echo
echo "Result Lists:"
cat hosts-hasilsorted
- name: Release hosts
run: |
cat hosts-hasilsorted | sudo tee -a releases/hosts > /dev/null
- name: Remove Adjacent Empty Lines
run: |
remove_adjacent_empty_lines() {
local file_path="$1"
local temp_file=$(mktemp)
awk 'NF || !p {print} {p = !NF}' "$file_path" > "$temp_file"
mv "$temp_file" "$file_path"
}
file_path='releases/hosts'
remove_adjacent_empty_lines "$file_path"
- name: Commit changes
env:
issue_number: ${{ github.event.issue.number }}
issue_user: ${{ github.event.issue.user.login }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "zksbot"
git add releases/hosts
domain=$(jq -r '.issue.body' "$GITHUB_EVENT_PATH" | sed -n '3p' | tr -d '[:space:]')
git commit -m "Fix $domain bug (Issue #$issue_number requested by @$issue_user)"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.UPDATE_TOKEN }}