|
1 |
| -name: PR Reviewer Agent |
| 1 | +name: PR Event Logger |
| 2 | + |
2 | 3 | on:
|
3 |
| - issue_comment: |
4 |
| - types: [created] |
5 | 4 | pull_request:
|
6 |
| - types: [opened, synchronize, reopened] |
7 |
| - push: |
| 5 | + types: [opened, reopened, ready_for_review, review_requested] |
| 6 | + issue_comment: |
| 7 | + types: [created, edited] |
| 8 | + |
8 | 9 | jobs:
|
9 |
| - process_pr_events: |
| 10 | + log-event: |
10 | 11 | runs-on: ubuntu-latest
|
11 | 12 | steps:
|
12 |
| - - name: Extract event details |
13 |
| - run: echo "EVENT_PAYLOAD=$(jq -c . < $GITHUB_EVENT_PATH)" >> $GITHUB_ENV |
14 |
| - |
15 |
| - - name: Generate Signature and Encrypt Token |
| 13 | + - name: Checkout repository |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v4 |
| 18 | + with: |
| 19 | + python-version: '3.9' |
| 20 | + |
| 21 | + - name: Run event logger |
16 | 22 | env:
|
17 |
| - WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} |
18 |
| - API_TOKEN: ${{ secrets.API_TOKEN }} |
19 |
| - run: | |
20 |
| - # Generate signature for the payload |
21 |
| - SIGNATURE=$(echo -n "$EVENT_PAYLOAD" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | cut -d " " -f2) |
22 |
| - echo "SIGNATURE=$SIGNATURE" >> $GITHUB_ENV |
23 |
| - |
24 |
| - # Create a consistent key from the webhook secret |
25 |
| - KEY=$(echo -n "$WEBHOOK_SECRET" | openssl dgst -sha256 | cut -d ' ' -f2) |
26 |
| - |
27 |
| - # Generate a random IV |
28 |
| - IV=$(openssl rand -hex 16) |
29 |
| - |
30 |
| - # Encrypt token with proper padding |
31 |
| - ENCRYPTED_TOKEN=$(echo -n "$API_TOKEN" | openssl enc -aes-256-cbc -a -A -K "$KEY" -iv "$IV" -md sha256) |
32 |
| - |
33 |
| - echo "ENCRYPTED_TOKEN=$ENCRYPTED_TOKEN" >> $GITHUB_ENV |
34 |
| - echo "TOKEN_IV=$IV" >> $GITHUB_ENV |
35 |
| - |
36 |
| - - name: Call External API (With Encrypted Token) |
37 |
| - run: | |
38 |
| - curl -X POST https://firstly-worthy-chamois.ngrok-free.app/github-webhook \ |
39 |
| - -H "Content-Type: application/json" \ |
40 |
| - -H "X-Hub-Signature-256: sha256=$SIGNATURE" \ |
41 |
| - -H "X-Encrypted-Token: $ENCRYPTED_TOKEN" \ |
42 |
| - -H "X-Token-IV: $TOKEN_IV" \ |
43 |
| - -d "$EVENT_PAYLOAD" |
| 23 | + GITHUB_EVENT_NAME: ${{ github.event_name }} |
| 24 | + GITHUB_EVENT_PATH: ${{ github.event_path }} |
| 25 | + run: python main.py |
| 26 | + |
0 commit comments