Skip to content

Conversation

@desrosj
Copy link
Member

@desrosj desrosj commented Jul 18, 2025

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

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update
  • Refactoring / housekeeping (changes to files not directly related to functionality)

Development

  • Tests
  • Dependency update
  • Environment update / refactoring
  • Documentation Update

Visual

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web-browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@desrosj desrosj self-assigned this Jul 18, 2025
Copilot AI review requested due to automatic review settings July 18, 2025 16:34
Copy link
Contributor

Copilot AI left a 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:

Comment on lines +32 to +33
base-branch: ${{ github.event.workflow_run.inputs.target-branch }}
head-branch: ${{ github.event.workflow_run.inputs.source-branch }}
Copy link

Copilot AI Jul 18, 2025

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.

Suggested change
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 }}

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +33
base-branch: ${{ github.event.workflow_run.inputs.target-branch }}
head-branch: ${{ github.event.workflow_run.inputs.source-branch }}
Copy link

Copilot AI Jul 18, 2025

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.

Suggested change
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 }}

Copilot uses AI. Check for mistakes.
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.'
Copy link

Copilot AI Jul 18, 2025

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.

Suggested change
pr-title: 'Need to figure out how to pass this along.'
pr-title: ${{ github.event.workflow_run.display_title }}

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +13
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

use of fundamentally insecure workflow trigger
@circlecube
Copy link
Member

@desrosj - are you still working on this or do you still need this PR open?

@desrosj
Copy link
Member Author

desrosj commented Oct 27, 2025

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants