GitHub Action
bagbyte/use-private-action
v0.0.2
Latest version
This action allow to use custom actions in private GitHub repository.
# .github/workflows/my-workflow.yml
jobs:
my_job:
...
steps:
- uses: bagbyte/[email protected]
with:
private-action:
private-action-token: ${{ secrets.PRIVATE_REPO_ACCESS_TOKEN }}
- ... other steps
Note: both private-action
and private-action-token
are required fields. private-action
has the same format as the value you can use in the uses
: {org}/{repo}[/path]@ref
To access private repositories, you need to create an access token. To create a new access token:
- Access your Developer Settings on this page
- Click on
Generate new token
button - Enter your password to confirm your identity
- Assign a name to this token (i.e.
Github actions private repository
) - Select
repo
(this allows this access token to access your repositories) - Copy the generated token (once you leave this page the value will not be accessible anymore, so take care of pasting somewhere)
We need to create a Secret, in th repository where you will use this action. To do that:
- Go to your repository
Settings > Secrets
- Click on
Add ay new secret
link - Choose a name for this secret (i.e.
PRIVATE_REPO_ACCESS_TOKEN
), and add the previously copied value of the token in theValue
box
In case your action is written in Typescript
, the repository should contain the build folder.
Your private repository must have node_modules
folder committed.
To allow this action to execute and run your code, you should export the main function in your private action main file.
// dist/main.js
...
export function start() {
...
}
...
start();
Right now it supports only nodejs actions.