A GitHub Action to automatically post links to build artifacts as a comment on pull requests.
- Posts a comment with download links to all artifacts generated by the workflow run.
- Optionally comments a warning if no artifacts are found.
- Can be triggered conditionally (e.g., by label or workflow logic).
| Name | Description | Required | Default |
|---|---|---|---|
github-token |
GitHub token for authentication | Yes | ${{ github.token }} |
comment-heading |
Heading for the comment | No | 📦 **Build Artifacts** |
comment-if-no-artifacts |
Comment posted if no artifacts are found | No | "" |
Add this action to your workflow after your build and artifact upload steps:
- name: Post artifact links to PR
uses: RubberDuckCrew/artifact2pr@v0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-heading: "📦 **Build Artifacts**"
comment-if-no-artifacts: "⚠️ No artifacts found."Note: Your workflow or job must include the following permissions:
permissions:
pull-requests: writename: Build and Post Artifacts
on:
pull_request:
types: [labeled, opened, synchronize]
permissions:
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: |
echo "Build your project here"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: my-artifact
path: ./path/to/artifact
- name: Post artifact links to PR
uses: RubberDuckCrew/artifact2pr@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-heading: "📦 **Build Artifacts**"
comment-if-no-artifacts: "⚠️ No artifacts found."- The action only runs on pull requests.
- Artifact download links require appropriate repository permissions.
- Artifacts are available for a limited time (default: 90 days).