Skip to content

pr comment

pr comment #30

name: "Test: PR"
on:
workflow_dispatch:
pull_request:
branches:
- main
- 'prerelease/**'
pull_request_target:
types:
- edited # Run only for PR body edits
jobs:
# pr-tags:
# if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' && github.event.action == 'edited'
# runs-on: ubuntu-latest
# outputs:
# tags: ${{ steps.pr-tags.outputs.tags }}
# steps:
# - uses: actions/checkout@v4
# - name: Parse Tags from PR Body
# id: pr-tags
# run: bash scripts/pr-tags-parse.sh "${{ github.event_path }}"
pr-tags:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch Tags from PR Comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Define the comment marker
COMMENT_MARKER="<!-- PR Tags -->"
# Fetch all comments for the PR
COMMENTS=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments)
# Find the comment containing the marker
COMMENT_BODY=$(echo "$COMMENTS" | jq -r ".[] | select(.body | contains(\"$COMMENT_MARKER\")) | .body")
if [ -z "$COMMENT_BODY" ]; then
echo "No PR Tags comment found. Exiting."
exit 1
fi
# Extract the tags from the comment body
TAGS=$(echo "$COMMENT_BODY" | awk '/Running E2E tests tagged with:/{flag=1; next} /<!--/{flag=0} flag' | tr -d '`')
if [ -z "$TAGS" ]; then
echo "No tags found in comment body. Exiting."
exit 1
fi
echo "Extracted Tags: $TAGS"
echo "tags=$TAGS" >> $GITHUB_ENV
e2e-electron:
if: github.event_name == 'pull_request'
name: e2e
uses: ./.github/workflows/test-e2e-linux.yml
needs: pr-tags
with:
grep: ${{ needs.pr-tags.outputs.tags }}
display_name: "electron (linux)"
currents_tags: "pull-request,electron/linux,${{ needs.pr-tags.outputs.tags }}"
secrets: inherit
unit-tests:
if: github.event_name == 'pull_request'
name: test
uses: ./.github/workflows/test-unit.yml
secrets: inherit
integration-tests:
if: github.event_name == 'pull_request'
name: test
uses: ./.github/workflows/test-integration.yml
secrets: inherit