forked from demisto/content
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (59 loc) · 2.33 KB
/
handle-new-external-pr.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
name: Handle New External PRs
on:
pull_request_target:
types: [opened]
permissions:
contents: read
jobs:
handle_new_external_pr:
runs-on: ubuntu-latest
if: github.repository == 'demisto/content' && github.event.action == 'opened' && github.event.pull_request.head.repo.fork == true && contains(github.head_ref, 'xsoar-bot-contrib-ContributionTestPack') == false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup Poetry
uses: Gr1N/setup-poetry@v9
- name: Print Context
run: |
echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Install Python Dependencies
run: |
poetry install --with github-actions
- name: set pythonpath
run: |
echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Update External PR
env:
CONTENTBOT_GH_ADMIN_TOKEN: ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
EVENT_PAYLOAD: ${{ toJson(github.event) }}
run: |
echo "Updating External PR ${{ github.event.pull_request.html_url }}"
cd .github/github_workflow_scripts
poetry run ./handle_external_pr.py
echo "Finished Handling External PR"
- name: Add Contribution Form Filled for Marketplace Contributions
if: contains(github.event.pull_request.title, '[Marketplace Contribution]')
run: gh pr edit "$PR_NUMBER" --add-label "$LABEL"
env:
GH_TOKEN: ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
LABEL: "Contribution Form Filled"
- name: Send Notification
if: startsWith(github.event.pull_request.title, 'test') != true
env:
CONTENTBOT_GH_ADMIN_TOKEN: ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
EVENT_PAYLOAD: ${{ toJson(github.event) }}
CORTEX_XSOAR_SLACK_TOKEN: ${{ secrets.CORTEX_XSOAR_SLACK_TOKEN }}
run: |
echo "Sending notification about External PR ${{ github.event.pull_request.html_url }}"
cd .github/github_workflow_scripts
poetry run ./send_slack_message.py