Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back PR commenting with artifact #70

Merged
merged 6 commits into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,36 @@ jobs:
release-url: ${{ github.event_name == 'release' && github.event.release.html_url || '' }}
release-version: ${{ github.event_name == 'release' && github.event.release.tag_name || '' }}

comment:
if: github.event_name == 'pull_request'
name: Comment on PR
runs-on: ubuntu-latest
needs:
- build-firmware
steps:
- name: Comment on PR
uses: actions/[email protected]
with:
script: |-
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
})
const url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts/${artifacts['data']['artifacts'][0]['id']}`
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Firmware built successfully! :tada:

[Download][download] and extract the firmware to install with https://web.esphome.io

Make sure to choose \`esphome-voice-kit-esp32s3/esphome-voice-kit-esp32s3.factory.bin\`.

[download]: ${url}`
})

upload:
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev')
name: Upload to R2
Expand Down