-
Notifications
You must be signed in to change notification settings - Fork 4
First pass at a reusable PR creation workflow #419
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a reusable workflow for creating pull requests that addresses GitHub Actions' limitations where workflows created by other workflows don't trigger expected events. The workflow is triggered when the 'Newfold Prepare Release' workflow completes and creates a pull request using a reusable workflow from the newfold-labs organization.
Key changes:
- Creates a new GitHub Actions workflow triggered by workflow_run events
- Implements concurrency control to prevent multiple simultaneous runs
- Calls a reusable workflow to handle the actual pull request creation
Comments suppressed due to low confidence (1)
.github/workflows/create-pull-request.yml:25
- [nitpick] The job name 'prep-release' doesn't accurately reflect its purpose of creating a pull request. Consider renaming to 'create-pr' or 'create-pull-request' to match the actual functionality.
prep-release:
| base-branch: ${{ github.event.workflow_run.inputs.target-branch }} | ||
| head-branch: ${{ github.event.workflow_run.inputs.source-branch }} |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow_run event context doesn't have an 'inputs' property. For workflow_run events, you should use '${{ github.event.workflow_run.head_branch }}' for the head branch and specify the base branch directly or use workflow_run conclusion data.
| base-branch: ${{ github.event.workflow_run.inputs.target-branch }} | |
| head-branch: ${{ github.event.workflow_run.inputs.source-branch }} | |
| base-branch: main | |
| head-branch: ${{ github.event.workflow_run.head_branch }} |
| base-branch: ${{ github.event.workflow_run.inputs.target-branch }} | ||
| head-branch: ${{ github.event.workflow_run.inputs.source-branch }} |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow_run event context doesn't have an 'inputs' property. Use '${{ github.event.workflow_run.head_branch }}' to get the branch that triggered the workflow run.
| base-branch: ${{ github.event.workflow_run.inputs.target-branch }} | |
| head-branch: ${{ github.event.workflow_run.inputs.source-branch }} | |
| base-branch: main | |
| head-branch: ${{ github.event.workflow_run.head_branch }} |
| base-branch: ${{ github.event.workflow_run.inputs.target-branch }} | ||
| head-branch: ${{ github.event.workflow_run.inputs.source-branch }} | ||
| workflow-id: ${{ github.event.workflow_run.id }} | ||
| pr-title: 'Need to figure out how to pass this along.' |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded placeholder title should be replaced with a dynamic value or proper configuration. Consider using workflow_run metadata like '${{ github.event.workflow_run.display_title }}' or constructing a meaningful title.
| pr-title: 'Need to figure out how to pass this along.' | |
| pr-title: ${{ github.event.workflow_run.display_title }} |
| on: | ||
| workflow_run: | ||
| workflows: | ||
| - 'Newfold Prepare Release' | ||
| types: | ||
| - 'completed' | ||
| branches: | ||
| - 'main' | ||
|
|
||
| # Cancels all previous workflow runs for pull requests that have not completed. |
Check failure
Code scanning / zizmor
use of fundamentally insecure workflow trigger Error
|
@desrosj - are you still working on this or do you still need this PR open? |
I'm not actively working on this, no. Whether it needs to stay open depends on if we think something like newfold-labs/workflows#74 is worth spending the time pursuing. |
DO NOT MERGE. THIS IS A PROOF OF CONCEPT.
Proposed changes
This explores how to address the fact that GitHub Action workflows created by other workflows do not trigger the expected events because of intentionally limited capabilities.
Type of Change
Production
Development
Visual
Checklist
Further comments