Skip to content

Replace create-pull-request with github-script - #74

Merged
cpanato merged 3 commits into
chainguard-dev:mainfrom
wistia:remove-create-pr-dependency
Apr 24, 2026
Merged

Replace create-pull-request with github-script#74
cpanato merged 3 commits into
chainguard-dev:mainfrom
wistia:remove-create-pr-dependency

Conversation

@chen-anders

@chen-anders chen-anders commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Similar to #73, this is a PR to replace peter-evans/create-pull-request with an first-party GitHub maintained actions/github-scriptequivalent. I figured that most orgs probably have the actions/github-script workflow step allowlisted.

Context: In our own org especially after the Trivy supply chain attacks, we've been wanting to be more restrictive with what 3rd-party GitHub actions can run on our workflows. (related issue: #58)


Disclaimer: Generated via Claude Code

Remove dependency on peter-evans/create-pull-request by using actions/github-script to implement PR creation directly.

Changes:

  • Uses actions/github-script v8 (official GitHub action)
  • Implements git operations (branch, commit, push) in JavaScript
  • Maintains all existing functionality:
    • Custom author/committer support
    • Signoff support
    • Commit signing via gitsign (when enabled)
    • PR create/update/reopen detection
    • Label management
    • Only commits changed files
    • Outputs PR number for compatibility
  • Simplified implementation (~140 lines)
  • Removes unnecessary validation for workflow-controlled inputs
  • Uses execFileSync with array arguments for security

Compatible with restricted GitHub Enterprise environments where community actions require whitelisting.

@chen-anders
chen-anders force-pushed the remove-create-pr-dependency branch 5 times, most recently from 2dadfd4 to 3252b4e Compare April 6, 2026 07:15
@chen-anders
chen-anders force-pushed the remove-create-pr-dependency branch from 3252b4e to 5e298ef Compare April 6, 2026 07:15
@stevebeattie
stevebeattie self-requested a review April 7, 2026 04:56
@cpanato

cpanato commented Apr 22, 2026

Copy link
Copy Markdown
Member

do you have an example of a PR that was generated using this change?

also need to fix a conflict

Comment thread action.yml Outdated
chen-anders and others added 2 commits April 23, 2026 02:47
Co-authored-by: Carlos Tadeu Panato Junior <ctadeu@gmail.com>
Signed-off-by: Anders Chen <anders@wistia.com>
Signed-off-by: Anders Chen <anders@wistia.com>
@chen-anders

Copy link
Copy Markdown
Contributor Author

I can put up a public repo example in the next day or two but we've been using our fork with this change in a number of our own internal repos.

@chen-anders

Copy link
Copy Markdown
Contributor Author

example PR: https://github.com/wistia/digestabot-demo/pull/1/changes

@cpanato
cpanato merged commit 6117a7b into chainguard-dev:main Apr 24, 2026
7 checks passed
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.

2 participants