Skip to content

Commit

Permalink
set default value of status input to false
Browse files Browse the repository at this point in the history
The update_pull_request_status input is now set to false by default.

This change is not backwards compatible.
Users, who wish to have the status in the PR displayed need to specify
this input explicitly in their yaml configuration file.

Reason for this change is, that there are more possible triggers for
TFaGA than Pull Request and Issue Comment and in those this setting is
not applicable when set to true.o

The tests have been adjusted so that only minimal test tests the
configuration when the update_pull_request_status is disabled.
The other tests test non-default behaviour when the PR update is
enabled, as they did test until now.
  • Loading branch information
zmiklank committed Jan 23, 2024
1 parent e0a278b commit 5f30148
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ 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. | true |
| `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
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

0 comments on commit 5f30148

Please sign in to comment.