Skip to content

Commit

Permalink
PR Identity
Browse files Browse the repository at this point in the history
Previously when a PR was created the author for the create commit was the
"actor" in the action.  In actions based on schedules, this actor is the
author of the last commit; the commit that the action reads its workflow from.
This behavior lead to commits appearing to come from real users rather than
the robots that were creating the PRs.

This change updates the author of the created commits to always be the same
bot that is creating the PR.

Signed-off-by: Ben Hale <bhale@vmware.com>
  • Loading branch information
nebhale committed Nov 18, 2020
1 parent 740d0d1 commit 87378bc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions octo/builder_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ func contributeBuildImage(descriptor Descriptor, image string, classifier string
{
Uses: "peter-evans/create-pull-request@v3",
With: map[string]interface{}{
"token": descriptor.GitHub.Token,
"token": descriptor.GitHub.Token,
"author": fmt.Sprintf("%[1]s <%[1]s@users.noreply.github.com>", descriptor.GitHub.Username),
"commit-message": fmt.Sprintf(`Bump %[1]s from ${{ steps.build-image.outputs.old-version }} to ${{ steps.build-image.outputs.new-version }}
Bumps %[1]s from ${{ steps.build-image.outputs.old-version }} to ${{ steps.build-image.outputs.new-version }}.`, image),
Expand Down Expand Up @@ -192,7 +193,8 @@ func contributeLifecycle(descriptor Descriptor) (Contribution, error) {
{
Uses: "peter-evans/create-pull-request@v3",
With: map[string]interface{}{
"token": descriptor.GitHub.Token,
"token": descriptor.GitHub.Token,
"author": fmt.Sprintf("%[1]s <%[1]s@users.noreply.github.com>", descriptor.GitHub.Username),
"commit-message": `Bump lifecycle from ${{ steps.lifecycle.outputs.old-version }} to ${{ steps.lifecycle.outputs.new-version }}
Bumps lifecycle from ${{ steps.lifecycle.outputs.old-version }} to ${{ steps.lifecycle.outputs.new-version }}.`,
Expand Down
3 changes: 2 additions & 1 deletion octo/buildpack_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ func ContributeBuildpackDependencies(descriptor Descriptor) ([]Contribution, err
}, {
Uses: "peter-evans/create-pull-request@v3",
With: map[string]interface{}{
"token": descriptor.GitHub.Token,
"token": descriptor.GitHub.Token,
"author": fmt.Sprintf("%[1]s <%[1]s@users.noreply.github.com>", descriptor.GitHub.Username),
"commit-message": fmt.Sprintf(`Bump %[1]s from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }}
Bumps %[1]s from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }}.`, d.Name),
Expand Down
3 changes: 2 additions & 1 deletion octo/package_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func contributePackageDependency(descriptor Descriptor, name string) (Contributi
{
Uses: "peter-evans/create-pull-request@v3",
With: map[string]interface{}{
"token": descriptor.GitHub.Token,
"token": descriptor.GitHub.Token,
"author": fmt.Sprintf("%[1]s <%[1]s@users.noreply.github.com>", descriptor.GitHub.Username),
"commit-message": fmt.Sprintf(`Bump %[1]s from ${{ steps.package.outputs.old-version }} to ${{ steps.package.outputs.new-version }}
Bumps %[1]s from ${{ steps.package.outputs.old-version }} to ${{ steps.package.outputs.new-version }}.`, name),
Expand Down
4 changes: 3 additions & 1 deletion octo/update_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package octo

import (
"fmt"
"path/filepath"

"github.com/paketo-buildpacks/pipeline-builder/octo/actions"
Expand Down Expand Up @@ -62,7 +63,8 @@ func ContributeUpdatePipeline(descriptor Descriptor) (Contribution, error) {
{
Uses: "peter-evans/create-pull-request@v3",
With: map[string]interface{}{
"token": descriptor.GitHub.Token,
"token": descriptor.GitHub.Token,
"author": fmt.Sprintf("%[1]s <%[1]s@users.noreply.github.com>", descriptor.GitHub.Username),
"commit-message": `Bump pipeline from ${{ steps.pipeline.outputs.old-version }} to ${{ steps.pipeline.outputs.new-version }}
Bumps pipeline from ${{ steps.pipeline.outputs.old-version }} to ${{ steps.pipeline.outputs.new-version }}.`,
Expand Down

0 comments on commit 87378bc

Please sign in to comment.