Skip to content

#71 for PR-16653

#71 for PR-16653 #10

name: Example report - PR (from issue)
run-name: "#${{ github.event.issue.number }} for PR-${{ github.event.issue.title }}"
on:
issues:
types:
- opened
env:
PER_PAGE: 20
permissions:
issues: write
jobs:
validate:
name: Validate Trigger
runs-on: ubuntu-latest
steps:
- name: Check if issue is a trigger or an actual issue
run: |
if ! [ -z "${{ github.event.issue.body }}" ]; then
echo "Issue body is not empty."
exit 1
fi
if ! [[ "${{ github.event.issue.title }}" =~ ^[0-9]+$ ]]; then
echo "Issue title is not a number."
exit 1
fi
- name: Post comment with workflow run link
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
RUN_ID=${{ github.run_id }}
PR_NUMBER=${{ github.event.issue.title }}
LF=$'\n'
COMMENT_BODY="Testing Bevy PR: https://github.com/bevyengine/bevy/pull/$PR_NUMBER ${LF}Workflow run started: https://github.com/${{ github.repository }}/actions/runs/$RUN_ID"
gh issue comment $ISSUE_NUMBER --body "$COMMENT_BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
get-environment:
name: Get Environment
needs: [validate]
runs-on: ubuntu-latest
outputs:
per_page: ${{ env.PER_PAGE }}
gitref: ${{ steps.env.outputs.gitref }}
date: ${{ steps.env.outputs.date }}
pixeleagle_project: ${{ steps.env.outputs.pixeleagle_project }}
steps:
- name: Checkout Bevy main branch
uses: actions/checkout@v4
with:
repository: 'bevyengine/bevy'
- name: Switch to PR
run: |
git fetch origin pull/${{ github.event.issue.title }}/head:pr-${{ github.event.issue.title }}
git switch pr-${{ github.event.issue.title }}
- name: Get Environment
id: env
run: |
echo "gitref=`git rev-parse HEAD`" >> $GITHUB_OUTPUT
echo "date=`date +%Y%m%d%H%M`" >> $GITHUB_OUTPUT
echo "pixeleagle_project=B25A040A-A980-4602-B90C-D480AB84076D" >> $GITHUB_OUTPUT
native-run:
name: Native
needs: [get-environment]
uses: ./.github/workflows/workflow-native.yml
with:
gitref: ${{ needs.get-environment.outputs.gitref }}
pixeleagle_project: ${{ needs.get-environment.outputs.pixeleagle_project }}
branch: "PR-${{ github.event.issue.title }}"
repository: "bevyengine/bevy"
per_page: "${{ needs.get-environment.outputs.per_page }}"
secrets: inherit
mobile-run:
name: Mobile
needs: [get-environment]
uses: ./.github/workflows/workflow-mobile.yml
with:
gitref: ${{ needs.get-environment.outputs.gitref }}
pixeleagle_project: ${{ needs.get-environment.outputs.pixeleagle_project }}
branch: "PR-${{ github.event.issue.title }}"
repository: "bevyengine/bevy"
secrets: inherit
wasm-run:
name: wasm
needs: [get-environment]
uses: ./.github/workflows/workflow-wasm.yml
with:
gitref: ${{ needs.get-environment.outputs.gitref }}
pixeleagle_project: ${{ needs.get-environment.outputs.pixeleagle_project }}
branch: "PR-${{ github.event.issue.title }}"
repository: "bevyengine/bevy"
secrets: inherit
report-on-issue:
name: Report on Issue
needs: [validate, get-environment, native-run, mobile-run, wasm-run]
runs-on: ubuntu-latest
if: ${{ always() && needs.validate.result == 'success' }}
steps:
- name: Comment with link to Pixel Eagle
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
COMMENT_BODY="All done! Check the results at: https://pixel-eagle.com/project/${{ needs.get-environment.outputs.pixeleagle_project }}?filter=PR-${{ github.event.issue.title }}"
gh issue comment $ISSUE_NUMBER --body "$COMMENT_BODY"
gh issue close $ISSUE_NUMBER --reason completed
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}