Skip to content

Conversation

rssnyder
Copy link
Contributor

@rssnyder rssnyder commented Jan 9, 2023

problem

A harness user is trying to use a github action composite while attempting to migrate from GHA to harness CIE. In doing so they attempted to use an image that relied on GITHUB_ACTOR env var, but were unable to set this var in the CI step.

Upon investigation it seems that this ENV var is set by the nektos/act cmd and not souced from the env.

solution

Add another setting to the plugin for an actor, and pass this thru to the same actor argument in act.

Source of the option in act: https://github.com/nektos/act/blob/master/cmd/root.go#L66

You can leave the setting out and it reverts back to the default of nektos/act

testing

There were no docs for what tests to do when contributing here, so I made my changes, linted the code, use the drone config to push my version to my own image rssnyder/github-actions and ran an action that would verify I was able to set the github actor.

before

              - step:
                  type: Plugin
                  name: debug
                  identifier: debug
                  spec:
                    connectorRef: account.dockerhub
                    image: plugins/github-actions
                    privileged: true
                    settings:
                      uses: rssnyder/public-action-step@main
                      with:
                        who-to-greet: <+pipeline.executionId>
                      env:
                        GITHUB_ACTOR: custom_actor
                    envVariables:
                      GITHUB_ACTOR: custom_actor

image

Execution link: https://app.harness.io/ng/#/account/wlgELJ0TTre5aZhzpt8gVA/cd/orgs/default/projects/development/pipelines/plugin/executions/hytRolBBRAiHGQPsuyBt1g/pipeline?stage=lhOy6gGlS5-Q_J2nUox0CQ&step=Er7aTlfbSk6oP4UX9gaK9w

after

               - step:
                  type: Plugin
                  name: debug
                  identifier: debug
                  spec:
                    connectorRef: account.dockerhub
                    image: rssnyder/github-actions
                    privileged: true
                    settings:
                      actor: custom_actor
                      uses: rssnyder/public-action-step@main
                      with:
                        who-to-greet: <+pipeline.executionId>

image

Execution link: https://app.harness.io/ng/#/account/wlgELJ0TTre5aZhzpt8gVA/cd/orgs/default/projects/development/pipelines/plugin/executions/EObWRJsBSgWhN8s4fzizvA/pipeline?stage=kygRQHDiT6KjyhSg3sORcQ&step=yoU-3_XJTwq4aUw-gpuv1g

@rssnyder rssnyder requested a review from shubham149 January 10, 2023 17:32
@shubham149 shubham149 merged commit a8d4a08 into drone-plugins:main Jan 11, 2023
@rssnyder rssnyder deleted the feat/expose_actor branch January 11, 2023 17:11
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