Skip to content

Commit

Permalink
[DROP] dummy comment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoreliovlabs committed Aug 29, 2024
1 parent 5821539 commit 7b670aa
Showing 1 changed file with 45 additions and 16 deletions.
61 changes: 45 additions & 16 deletions .github/workflows/rit.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,59 @@
name: PR Comment Trigger
name: Rootstock Integration Tests

on:
push:
branches:
- master
- '*-rc'
issue_comment:
types:
- created
- edited
pull_request:
types: [opened, reopened, synchronize]
branches:
- "**"

jobs:
check-pr-comment:
name: Check PR Comment
fetch-pr-info:
runs-on: ubuntu-latest

steps:
- name: Print GitHub Event Information
run: |
echo "GitHub Event Name: ${{ github.event_name }}"
echo "GitHub Event Action: ${{ github.event.action }}"
echo "GitHub Comment Body: ${{ github.event.comment.body }}"
echo "GitHub Repository: ${{ github.repository }}"
echo "GitHub Issue Number: ${{ github.event.issue.number }}"
- name: Checkout code
uses: actions/checkout@v3

- name: Check for /pipeline:run Command
- name: Set up GitHub CLI
uses: cli/cli-action@v2

- name: Determine PR Number
id: get_pr_number
run: |
COMMENT_BODY="${{ github.event.comment.body }}"
if [[ "$COMMENT_BODY" == *"/pipeline:run"* ]]; then
echo "Pipeline run command detected in the comment body."
echo "Triggering pipeline..."
# Determine PR number based on the event
if [ -n "${{ github.event.pull_request.number }}" ]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
elif [ -n "${{ github.event.issue.pull_request.url }}" ]; then
PR_URL="${{ github.event.issue.pull_request.url }}"
PR_NUMBER=$(echo "$PR_URL" | awk -F'/' '{print $NF}')
else
echo "Pipeline run command NOT found in the comment body."
echo "No PR number found"
exit 1
fi
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
- name: Fetch PR Details
run: |
echo "Fetching details for PR #${{ env.PR_NUMBER }}"
# Fetch PR details using GitHub CLI
gh pr view "${{ env.PR_NUMBER }}" --json title,body,number,comments,reviewRequests --jq '
.title as $title |
.body as $body |
.number as $number |
.comments.totalCount as $comments |
.reviewRequests.totalCount as $reviewRequests |
"Title: \($title)\nDescription: \($body)\nNumber: \($number)\nComments: \($comments)\nReview Requests: \($reviewRequests)"
'
# Fetch comments
echo "Fetching comments for PR #${{ env.PR_NUMBER }}"
gh pr view "${{ env.PR_NUMBER }}" --comments --jq '.[] | "\(.user.login): \(.body)"'

0 comments on commit 7b670aa

Please sign in to comment.