Skip to content

This is a Custom GitHub Action to raise automated PRs on dependant projects with latest vendoring of Go projects this action is employed for.

License

Notifications You must be signed in to change notification settings

AxiomSamarth/go-vendor-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Table of Content

Go Vendor Action

This action vendors the latest release of the Go project this is employed for; in the dependant Go project via an automated Pull Request.

For example, if project go-release-event is used by another go project go-release-consume then this action will vendor the latest go-release-event on to go-release-consume everytime when there is a new release of go-release-event project.


Usage

An example step of a job using this GitHub action is as follows:

- name: Revendor latest version
  uses: AxiomSamarth/go-vendor-action@main
  with:
    # The name of the dependant repository's owner
    # Required: True
    destination_repo_owner: AxiomSamarth

    # The name of the dependant repository which vendors
    # the project in the current scope of this action
    # Required: True
    destination_repo_name: go-release-consume   

Points to remember

  • The job consuming this GitHub action should export/declare the following environment variable

    • GITHUB_USER: GitHub username whose credentials will be used for git push and pull request actions.
    • GITHUB_PASSWORD: OAuth Token or Personal Access Token of the GITHUB_USER.
    • GITHUB_EMAIL: Email Id associated with the GitHub account of GITHUB_USER.
    • SRC_REPO_OWNER: The name of the owner of Go project which is to be vendored into dependant projects.
    • SRC_REPO_NAME: The name of the Go project which is to be vendored into dependant projects.
  • The recommendation is to create these environment variables using GitHub repository secrets. Read more.

  • The GITHUB_USER should have write access to the dependant project as this action clones the dependant project (and not fork it), creates a new working branch, vendors the changes in the new branch and raises a pull request to the main branch.

  • The GitHub action consuming this should also configure the Git credentials before running this step. A reference step is as shown below

    - name: Configure Git
        run: |
        echo "github.com:\n- user: $GITHUB_USER\n  oauth_token: ${{ secrets.TOKEN }}\n  protocol: https" > ~/.config/hub
        git config --global user.email $GITHUB_EMAIL
        git config --global user.name $GITHUB_USER

Examples

  • Check this example workflow defined in go-release-event here.

  • Example automated PR onto go-release-consume raised by the above workflow with vendored files of latest release of go-release-event project.

Contribution guidelines

  • Please open an issue to report a bug or to suggest improvements.
  • Pull Requests without issues will not be entertained.

About

This is a Custom GitHub Action to raise automated PRs on dependant projects with latest vendoring of Go projects this action is employed for.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages