Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set default value of status input to false + minor readme update #78

Merged
merged 3 commits into from
Jan 23, 2024
Merged
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
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ See [Testing Farm onboarding guide](https://docs.testing-farm.io/general/0.1/onb
| `create_issue_comment` | If GitHub action will create a github issue comment | false |
| `pull_request_status_name` | GitHub pull request status name | Fedora |
| `debug` | Print debug logs when working with testing farm | true |
| `update_pull_request_status` | Action will update pull request status. Default: true | true |
| `environment_settings` | Pass custom settings to the test environment. Default: {} | empty |
| `pr_head_sha` | SHA of the latest commit in PR. Used for setting commit statuses. | $(git rev-parse HEAD) |
| `update_pull_request_status` | Action will update pull request status. | false |
| `environment_settings` | Pass custom settings to the test environment. | empty |
| `create_github_summary` | Create summary of the Testing Farm as GiHub Action job. Possible options: "false", "true", "key=value" | true |
| `timeout` | Timeout for the Testing Farm job in minutes. | 480 |

Expand Down
14 changes: 5 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ inputs:
description: 'A testing farm API key'
required: true
git_url:
description: 'An url to the GIT repository'
description: 'An url to the GIT repository with TMT plans'
required: true
git_ref:
description: 'A tmt tests branch which will be used for tests'
description: 'A TMT tests branch which will be used for tests'
required: false
default: 'master'
github_token:
description: GitHub TOKEN or PAT
description: 'GitHub TOKEN or PAT'
required: false
default: ${{ github.token }}
default: '${{ github.token }}'
tmt_plan_regex:
required: false
description: 'A tmt plan regex which will be used for selecting plans. By default all plans are selected.'
Expand All @@ -50,7 +50,7 @@ inputs:
update_pull_request_status:
description: 'Action will update pull request status. Default: true'
required: false
default: 'true'
default: 'false'
create_github_summary:
description: 'Action will create github summary. Possible options: "false", "true", "key=value"'
required: false
Expand Down Expand Up @@ -79,10 +79,6 @@ inputs:
description: 'Pass specific settings, like post-install-script, to the testing environment.'
required: false
default: '{}'
pr_head_sha:
description: 'HEAD SHA of a Pull Request. Used for posting statuses to the PR. The value is obtained from `git rev-parse HEAD` if this input is not set.'
required: false
default: ''
timeout:
description: 'Action is waiting for testing farm to finish or until timeout is reached. Value is in minutes.'
required: false
Expand Down
5 changes: 1 addition & 4 deletions dist/action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ async function action(pr: PullRequest): Promise<void> {
const api = new TestingFarmAPI(tfInstance);

// Get commit SHA value
let sha = getInput('pr_head_sha');
if (sha === '') {
sha = pr.sha;
}
const sha = pr.sha;
debug(`SHA: '${sha}'`);

// Set artifacts url
Expand Down
19 changes: 10 additions & 9 deletions tests/action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function setDefaultInputs() {
vi.stubEnv('INPUT_VARIABLES', '');
// secrets - Secret environment variables for test env, separated by ;
vi.stubEnv('INPUT_SECRETS', '');
// update_pull_request_status - Action will update pull request status. Default: true
vi.stubEnv('INPUT_UPDATE_PULL_REQUEST_STATUS', 'true');
// update_pull_request_status - Action will update pull request status. Default: false
vi.stubEnv('INPUT_UPDATE_PULL_REQUEST_STATUS', 'false');
// create_github_summary - Action will create github summary. Possible options: "false", "true", "key=value"
vi.stubEnv('INPUT_CREATE_GITHUB_SUMMARY', 'true');
// arch - Define an architecture for testing environment. Default: x86_64
Expand Down Expand Up @@ -218,17 +218,13 @@ describe('Integration tests', () => {
);

// First call to request PR details, next two calls for setting the status
expect(mocks.request).toHaveBeenCalledTimes(3);
expect(mocks.request).toHaveBeenCalledTimes(1);
expect(mocks.request).toHaveBeenLastCalledWith(
'POST /repos/{owner}/{repo}/statuses/{sha}',
'GET /repos/{owner}/{repo}/pulls/{pull_number}',
{
context: 'Testing Farm - Fedora',
description: 'Build finished - \\o/',
owner: 'sclorg',
pull_number: 1,
repo: 'testing-farm-as-github-action',
sha: 'd20d0c37d634a5303fa1e02edc9ea281897ba01a',
state: 'success',
target_url: 'https://artifacts.dev.testing-farm.io/1',
}
);

Expand All @@ -253,6 +249,7 @@ describe('Integration tests', () => {
);
// tmt_plan_regex - A tmt plan regex which will be used for selecting plans. By default all plans are selected
vi.stubEnv('INPUT_TMT_PLAN_REGEX', 'fedora');
vi.stubEnv('INPUT_UPDATE_PULL_REQUEST_STATUS', 'true');

// Mock Testing Farm API
vi.mocked(mocks.newRequest).mockImplementation(
Expand Down Expand Up @@ -332,6 +329,7 @@ describe('Integration tests', () => {
);
// tmt_plan_regex - A tmt plan regex which will be used for selecting plans. By default all plans are selected
vi.stubEnv('INPUT_TMT_PLAN_REGEX', 'fedora');
vi.stubEnv('INPUT_UPDATE_PULL_REQUEST_STATUS', 'true');

// Mock Testing Farm API
vi.mocked(mocks.newRequest).mockImplementation(
Expand Down Expand Up @@ -411,6 +409,7 @@ describe('Integration tests', () => {
);
// tmt_plan_regex - A tmt plan regex which will be used for selecting plans. By default all plans are selected
vi.stubEnv('INPUT_TMT_PLAN_REGEX', 'fedora');
vi.stubEnv('INPUT_UPDATE_PULL_REQUEST_STATUS', 'true');

// Override default inputs
// Action is waiting for testing farm to finish or until timeout is reached
Expand Down Expand Up @@ -477,6 +476,7 @@ describe('Integration tests', () => {
);
// tmt_plan_regex - A tmt plan regex which will be used for selecting plans. By default all plans are selected
vi.stubEnv('INPUT_TMT_PLAN_REGEX', 'fedora');
vi.stubEnv('INPUT_UPDATE_PULL_REQUEST_STATUS', 'true');

// Override default inputs
// tf_scope - Defines the scope of Testing Farm. Possible options are public and private
Expand Down Expand Up @@ -551,6 +551,7 @@ describe('Integration tests', () => {
);
// tmt_plan_regex - A tmt plan regex which will be used for selecting plans. By default all plans are selected
vi.stubEnv('INPUT_TMT_PLAN_REGEX', 'fedora');
vi.stubEnv('INPUT_UPDATE_PULL_REQUEST_STATUS', 'true');

// Override default inputs
// create_issue_comment - It creates a github issue Comment
Expand Down
Loading