-
Notifications
You must be signed in to change notification settings - Fork 214
Allow contributor PRs to run tests - CLI #1866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
haritamar
merged 5 commits into
master
from
ele-4203-make-it-possible-to-run-tests-on-contributor-prs
Mar 25, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4c4f9ad
use pull_request_target + environment to allow running tests on contr…
haritamar 74fad2a
run-precommit should be on PR branch
haritamar 28da92a
a bit safer condition
haritamar ac4dd8c
CR fixes
haritamar a092fb0
no need for pull_request_target in precommit
haritamar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,29 +3,26 @@ name: Close Pylon Ticket on Issue or Pull Request Closure | |
| on: | ||
| issues: | ||
| types: [closed] | ||
| pull_request: | ||
| pull_request_target: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In both repos we are checking:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 != '' | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.