Skip to content

Add a new input argument pr_number to support trigger types other than pull_request? #101

@leofang

Description

@leofang

Hi! Thank you for creating this nice action. We'd like to use it in our repo, but our project has a delicate CI so that using a standalone workflow to trigger this action following the instruction

on:
  pull_request:
    types:
      ...

jobs:
  deploy-preview:
    runs-on: ubuntu-latest
    steps:
      ...
      - uses: rossjrw/pr-preview-action@v1
        with:
         ...

is not suitable for our CI. Instead, we'd like to call this action as part of our doc build workflow, which in turn is a reusable workflow launched as part of the main CI. But it means our doc build workflow has

on:
  workflow_call:
    ...

and therefore the pr-preview-action cannot get the current PR number.

My suggestion is instead of looking it up for users based on the pull_request trigger, we allow a new input argument for users to overwrite this behavior (and this can be looked up in any workflow from the github context, I think):

on:
  workflow_call:
    ...

jobs:
  build-and-preview:
    runs-on: ubuntu-latest
    steps:
      ...
      - uses: rossjrw/pr-preview-action@v1
        with:
          pr_number: ${ user-provided-number, fetch-able from the main workflow }
          ...

Is this feasible? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions