Skip to content

A GitHub Action to automatically post links to build artifacts as a comment on pull requests.

License

Notifications You must be signed in to change notification settings

RubberDuckCrew/artifact2pr

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Artifact2PR

A GitHub Action to automatically post links to build artifacts as a comment on pull requests.

Features

  • 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).

Inputs

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 ""

Usage

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: write

Example Workflow

name: 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."

Notes

  • The action only runs on pull requests.
  • Artifact download links require appropriate repository permissions.
  • Artifacts are available for a limited time (default: 90 days).

License

MIT

About

A GitHub Action to automatically post links to build artifacts as a comment on pull requests.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •