-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (68 loc) · 2.69 KB
/
pr-bot.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
name: CI / Automated Pull Request
on:
push:
branches-ignore:
- "master"
- "old"
- "main"
- "2023"
- "nov-2023"
- "specialized-commits"
workflow_dispatch:
schedule:
- cron: '0 */1 * * *'
jobs:
create_pr:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' && github.event.pusher.name != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
- name: Create or Update Pull Request
id: create-pr
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.BOT_TOKEN }}
destination_branch: "master"
pr_title: "Hamster Left A Pull Request - (${{ github.event.head_commit.message }})"
pr_body: "### Hamster is working here. Sit Tight !"
pr_reviewer: "offensive-vk"
pr_label: "bot,automated,hamster"
pr_assignee: "TheHamsterBot"
pr_draft: false
- name: Save PR Number in ENV
run: echo "PR_NUMBER=${{ steps.create-pr.outputs.number }}" >> $GITHUB_ENV; echo "Pull Request Number - ${{ env.PR_NUMBER }}"
update_pr:
needs: create_pr
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' && github.event.pusher.name != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
- name: Generate Pull Request Template
run: |
timestamp=$(date '+%b %d, %A %I:%M:%S %p')
markdown=$(cat <<EOF
## This Pull Request Was Automated by [Hamster [bot]](https://github.com/TheHamsterBot)
> [!NOTE]
> Workflow Trigger: ${{ github.event_name }} event ${{ github.action_ref }} .
> Details of Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- Author: @TheHamsterBot
- Branch: master (base) / ${{ github.event.ref }} (head)
- Commit: ${{ github.sha }}
- Workflow Path: ${{ github.workflow }}
- Pull Request Number: ${{ env.PR_NUMBER }} || ${{ steps.create-pr.outputs.number }}
- Pusher Details: ${{ github.event.pusher.name }} <${{ github.event.pusher.email }}>
---
Thanks.
$timestamp
Your Hamster 🐹 <code>PF78VAPPKLZ2</code>
EOF)
echo "$markdown" > .github/Auto_Pull_Request.md
echo "MARKDOWN<<EOF" >> $GITHUB_ENV
echo "$markdown" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Update Pull Request Body
run: |
gh pr edit "$PR_NUMBER" --body "$MARKDOWN"
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}