[GH-ISSUE #1424] Allow GITHUB_REPOSITORY to be overridden #746

Closed
opened 2026-03-01 21:46:02 +03:00 by kerem · 12 comments
Owner

Originally created by @emmjohnson on GitHub (Nov 4, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1424

Act version

0.2.33

Feature description

When developing a github action, it would be cool to be able to write end to end tests with act. We would need the ability to override GITHUB_REPOSITORY (and SHA) to emulate a user using our action in their repo.

Currently GITHUB_REPOSITORY is automatically set to the action we are developing the action in.

Originally created by @emmjohnson on GitHub (Nov 4, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1424 ### Act version 0.2.33 ### Feature description When developing a github action, it would be cool to be able to write end to end tests with act. We would need the ability to override GITHUB_REPOSITORY (and SHA) to emulate a user using our action in their repo. Currently GITHUB_REPOSITORY is automatically set to the action we are developing the action in.
kerem 2026-03-01 21:46:02 +03:00
Author
Owner

@KnisterPeter commented on GitHub (Nov 4, 2022):

You can do with an event json file

<!-- gh-comment-id:1303987488 --> @KnisterPeter commented on GitHub (Nov 4, 2022): You can do with an event json file
Author
Owner

@emmjohnson commented on GitHub (Nov 4, 2022):

I'm having a hard time finding any simple examples of this, do you know of any?

<!-- gh-comment-id:1304272056 --> @emmjohnson commented on GitHub (Nov 4, 2022): I'm having a hard time finding any simple examples of this, do you know of any?
Author
Owner

@KnisterPeter commented on GitHub (Nov 4, 2022):

The payloads (link on each event) does contain examples per event:
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows

<!-- gh-comment-id:1304275225 --> @KnisterPeter commented on GitHub (Nov 4, 2022): The payloads (link on each event) does contain examples per event: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
Author
Owner

@KnisterPeter commented on GitHub (Nov 4, 2022):

After some more thoughts I'm not sure if all props could be set by the event file.
I'll reopen the request. Maybe someone is willing to implement it

<!-- gh-comment-id:1304276666 --> @KnisterPeter commented on GitHub (Nov 4, 2022): After some more thoughts I'm not sure if all props could be set by the event file. I'll reopen the request. Maybe someone is willing to implement it
Author
Owner

@emmjohnson commented on GitHub (Nov 4, 2022):

Okay, I tried a few things with the events and inputs and was unable to achieve setting the GITHUB_REPOSITORY

<!-- gh-comment-id:1304279571 --> @emmjohnson commented on GitHub (Nov 4, 2022): Okay, I tried a few things with the events and inputs and was unable to achieve setting the GITHUB_REPOSITORY
Author
Owner

@ChristopherHX commented on GitHub (Nov 4, 2022):

You can create an empty git repository with a different origin, everything else needs code changes of act.

git init
git remote add origin https://github.com/owner/repo

I added in a similar tool like this one the following cli flags --repository, --sha, --ref to override the guessed values

To set a random github.sha, just commit a file.

<!-- gh-comment-id:1304315009 --> @ChristopherHX commented on GitHub (Nov 4, 2022): You can create an empty git repository with a different origin, everything else needs code changes of act. ``` git init git remote add origin https://github.com/owner/repo ``` _I added in a similar tool like this one the following cli flags `--repository`, `--sha`, `--ref` to override the guessed values_ To set a random github.sha, just commit a file.
Author
Owner

@emmjohnson commented on GitHub (Nov 8, 2022):

What tool did you add @ChristopherHX ?

<!-- gh-comment-id:1307522241 --> @emmjohnson commented on GitHub (Nov 8, 2022): What tool did you add @ChristopherHX ?
Author
Owner

@ChristopherHX commented on GitHub (Nov 8, 2022):

As I have mentioned you can change GITHUB_REPOSITORY via a workaround in act.

What tool did you add @ChristopherHX ?

You find a comment about a tool based on actions/runner in https://github.com/cli/cli/issues/3585

<!-- gh-comment-id:1307670269 --> @ChristopherHX commented on GitHub (Nov 8, 2022): <details><summary>As I have mentioned you can change GITHUB_REPOSITORY via a workaround in act.</summary> > What tool did you add @ChristopherHX ? You find a comment about a tool based on actions/runner in https://github.com/cli/cli/issues/3585 </details>
Author
Owner

@shubhbapna commented on GitHub (Dec 19, 2022):

Is it possible to have an option to override any of the GITHUB_ env variables? We create local repositories to run the e2e tests for our custom actions. So, it would be helpful to control those variables in that environment.

<!-- gh-comment-id:1358055682 --> @shubhbapna commented on GitHub (Dec 19, 2022): Is it possible to have an option to override any of the `GITHUB_` env variables? We create local repositories to run the e2e tests for our custom actions. So, it would be helpful to control those variables in that environment.
Author
Owner

@shubhbapna commented on GitHub (Jan 24, 2023):

@KnisterPeter @ChristopherHX are y'all open to adding this feature? I am willing to create a PR for it

<!-- gh-comment-id:1402071452 --> @shubhbapna commented on GitHub (Jan 24, 2023): @KnisterPeter @ChristopherHX are y'all open to adding this feature? I am willing to create a PR for it
Author
Owner

@KnisterPeter commented on GitHub (Jan 24, 2023):

Yes, from my point of view it's fine.

<!-- gh-comment-id:1402078808 --> @KnisterPeter commented on GitHub (Jan 24, 2023): Yes, from my point of view it's fine.
Author
Owner

@ChristopherHX commented on GitHub (Jan 24, 2023):

Yes, such a feature would get my approval.

<!-- gh-comment-id:1402082793 --> @ChristopherHX commented on GitHub (Jan 24, 2023): Yes, such a feature would get my approval.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#746
No description provided.