Skip to content

PR comment github action tests #43

PR comment github action tests

PR comment github action tests #43

name: PR comment github action tests
on:
workflow_dispatch:
branches-ignore:
- main
issue_comment:
types:
- created
- labeled
branches-ignore:
- main
pull_request_review_comment:
types: [created, deleted]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
reply-and-trigger:
if: contains(github.event.comment.body,'/pytest')
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Trigger specific job
run: |
echo "${{ github.head_ref }}"
echo "${{ github.ref }}"
# - name: Set up GitHub CLI
# uses: actions/checkout@v4
#
# - name: Reply to the comment
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh api \
# --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
# -f "body=This comment contains /pytest, running the specified job..."
#
# - name: Create Run
# id: create_run
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# run: |
# gh api \
# --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
# -f "target_url=$GITHUB_RUN_URL" -f "state=pending" -f "description=Custom CI job" -f "context=pytest/custom-tests"
# - name: Trigger specific job
# run: |
# echo "Running the specific job because /pytest was found"
# # Add the logic to trigger your specific job here
# - name: Update Check Run Status
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# run: |
# gh api \
# --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
# -f "target_url=$GITHUB_RUN_URL" -f "state=success" -f "description=Custom CI job" -f "context=pytest/custom-tests"