Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ where
2. `${{ secret.ALLURE_TOKEN }}` is the personal API token created in your profile of Allure TestOps. You need to save API token under `/settings/secrets/actions` as a secret `ALLURE_TOKEN` in your GitHub repository and use it as the reference to the created secret – `${{ secret.ALLURE_TOKEN }}`. Having this parameter saved as plain text in the workflow is a bad-bad-bad idea.
3. <PRJ_ID> is the ID of a project to which you are sending the test results.

### For Github Enterprise
Depending on the scope of the Github token provided by default to the workflow, two tokens may be required for this action:

```yaml
- uses: allure-framework/setup-allurectl@v1
with:
allure-endpoint: https://ALURE_TESTOPS_URL
allure-token: ${{ secret.ALLURE_TOKEN }}
allure-project-id: <PRJ_ID>
github-token: ${{ secret.GITHUB_TOKEN }}
github-workflow-token: ${{ secret.GITHUB_WORKFLOW_TOKEN }}
```
where
1. `${{ secret.GITHUB_TOKEN }}` allows access to public Github
2. `${{ secret.GITHUB_WORKFLOW_TOKEN }}` allows access to information from the current workflow in Github Enterprise

### Use allurectl to upload the test results to Allure TestOps

```yaml
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ inputs:
description: 'The ID of a project on the Allure TestOps side to which allurectl must send the test results'
required: false
github-token:
description: The GitHub token used to create an authenticated client
description: 'The GitHub token used to create an authenticated client to call https://api.github.com.'
default: ${{ github.token }}
required: false
github-workflow-token:
description: 'The GitHub token used to create an authenticated client to access Workflow metadata.'
default: ${{ github.token }}
required: false
runs:
Expand Down
7 changes: 5 additions & 2 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function testTool(cmd: string, args: string[]) {
}

export async function setUpTool() {
const github_token = core.getInput('github-token', {required: true})
const github_token = core.getInput('github-workflow-token', {required: true})
const client: ClientType = github.getOctokit(github_token)

const owner = github.context.repo.owner
Expand All @@ -91,7 +91,10 @@ export async function setUpTool() {

export async function getVersion(inputVersion: string): Promise<string> {
const github_token = core.getInput('github-token', {required: true})
const client: ClientType = github.getOctokit(github_token)

const client: ClientType = github.getOctokit(github_token, {
baseUrl: 'https://api.github.com'
})

if (inputVersion && inputVersion !== 'latest') {
const response = await client.rest.repos.getReleaseByTag({
Expand Down