PR comment github action tests #68
Workflow file for this run
This file contains 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
name: PR comment github action tests | |
on: | |
issue_comment: | |
types: | |
- created | |
- labeled | |
branches-ignore: | |
- main | |
pull_request_review_comment: | |
types: [created, deleted] | |
pull_request: | |
concurrency: | |
# But this will cancel the current job no ? Because they have the same PR number ... (any comment even not the target one) | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number }}-${{ contains(github.event.comment.body, '/pytest') }} | |
cancel-in-progress: ${{ (github.event.issue.pull_request != null || github.event.pull_request != null) && contains(github.event.comment.body, '/pytest') }} | |
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 }}" | |
echo "${{ github.sha }}" | |
echo "${{ github.event.pull_request.number }}" | |
echo "${{ github.event.issue.number }}" | |
echo "${{ github.event.issue.pull_request }}" | |
echo "${{ github.event.pull_request }}" | |
echo "${{ github.event.issue.pull_request != null }}" | |
echo "${{ github.event.pull_request != null }}" | |
echo "${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number }}-${{ contains(github.event.comment.body, '/pytest') }}" | |
sleep 15m | |
# - 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" |