Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/close_pylon_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@ name: Close Pylon Ticket on Issue or Pull Request Closure
on:
issues:
types: [closed]
pull_request:
pull_request_target:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Pylon actions don't actually need an environment, since they don't need the PR code, just the PR details.
To be safe I actually removed the checkout which is unneeded.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In both repos we are checking: github.event_name == 'pull_request'. I don't think it will work.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks!

types: [closed]

jobs:
close_pylon_ticket:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Extract Pylon Ticket ID
id: extract_ticket_id
run: |
if [[ "${{ github.event_name }}" == 'issues' ]]; then
ISSUE_BODY=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" | jq -r '.body')
pylon_ticket_id=$(echo "$ISSUE_BODY" | grep -oP '(?<=<!-- pylon-ticket-id: )\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b(?= -->)')
elif [[ "${{ github.event_name }}" == 'pull_request' ]]; then
elif [[ "${{ github.event_name }}" =~ ^pull_request ]]; then
PR_BODY=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" | jq -r '.body')
pylon_ticket_id=$(echo "$PR_BODY" | grep -oP '(?<=<!-- pylon-ticket-id: )\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b(?= -->)')
fi
echo "::set-output name=pylon_ticket_id::$pylon_ticket_id"
echo "pylon_ticket_id=$pylon_ticket_id" >> "$GITHUB_OUTPUT"

- name: Close Pylon Ticket
if: steps.extract_ticket_id.outputs.pylon_ticket_id != ''
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/create_pylon_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ name: Create Pylon Issue
on:
issues:
types: [opened]
pull_request:
pull_request_target:
types: [opened]

jobs:
create_pylon_issue:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Install jq
run: sudo apt-get install -y jq

Expand Down Expand Up @@ -46,7 +43,7 @@ jobs:
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}"

- name: Create Pylon Issue for Pull Request
if: github.event_name == 'pull_request'
if: contains(github.event_name, 'pull_request')
run: |
response=$(curl --request POST \
--url https://api.usepylon.com/issues \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-main-warehouse.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Test main warehouse platform
on:
pull_request:
pull_request_target:
branches: ["master"]
paths:
- elementary/**
Expand All @@ -13,4 +13,5 @@ jobs:
uses: ./.github/workflows/test-warehouse.yml
with:
warehouse-type: postgres
elementary-ref: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.sha) || '' }}
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/test-warehouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ env:
jobs:
test:
runs-on: ubuntu-latest
environment: elementary_test_env # This is a github environment (not to be confused with env vars)
defaults:
run:
working-directory: elementary
Expand Down
Loading