Skip to content

Commit

Permalink
Triggering only when pipeline:run is commented
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoreliovlabs committed Aug 29, 2024
1 parent a679f87 commit abbcec2
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/rit.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Rootstock Integration Tests

on:
push:
branches:
- "master"
- "*-rc"
# push:
# branches:
# - "master"
# - "*-rc"
pull_request:
types: [opened, reopened, synchronize]
branches:
Expand All @@ -13,6 +13,10 @@ on:
types:
- created
- edited
permissions:
contents: write
issues: write


jobs:
rootstock-integration-tests:
Expand Down Expand Up @@ -56,24 +60,36 @@ jobs:
echo "FED Branch: $(jq -r '.fed_branch' debug-values.json)"
echo "RIT Branch: $(jq -r '.rit_branch' debug-values.json)"
- name: Test Token Permissions
run: |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user
- name: Checkout Rootstock Integration Tests Repository
uses: actions/checkout@v4
with:
repository: rsksmart/rootstock-integration-tests
ref: ${{ env.RIT_BRANCH }}
fetch-depth: 0

- name: Debug Comment Event
if: github.event_name == 'issue_comment'
run: |
echo "Comment body: ${{ github.event.comment.body }}"
- name: Check Comment Condition
if: github.event_name == 'issue_comment'
run: |
echo "Evaluating condition..."
if [[ "${{ github.event_name }}" == "issue_comment" && "${{ github.event.comment.body }}" == *"/pipeline:run"* ]]; then
if [[ "${{ github.event.comment.body }}" == *"/pipeline:run"* ]]; then
echo "Condition met: Pipeline run command detected in comment."
else
echo "Condition not met: Comment body is '${{ github.event.comment.body }}'"
fi
- name: Run Rootstock Integration Tests
if: github.event_name == 'pull_request' || (github.event_name == 'issue_comment' && contains(github.event.comment.body, '/pipeline:run'))
if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/pipeline:run')
uses: rsksmart/rootstock-integration-tests@v1
with:
rskj-branch: ${{ env.RSKJ_BRANCH }}
Expand Down

0 comments on commit abbcec2

Please sign in to comment.