Skip to content

Commit

Permalink
feat: update default value of git_ref
Browse files Browse the repository at this point in the history
By default use `github.ref` and use `master` as a fallback.
  • Loading branch information
jamacku authored and phracek committed Jul 3, 2024
1 parent 3d7dabc commit b8fe742
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 12 deletions.
1 change: 0 additions & 1 deletion .github/workflows/base-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
uses: ./
with:
api_key: ${{ secrets.TF_PUBLIC_API_KEY }}
git_ref: "main"
tmt_plan_regex: "smoke_plan"
pull_request_status_name: "Smoke test"
update_pull_request_status: "true"
1 change: 0 additions & 1 deletion .github/workflows/secrets_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
uses: ./
with:
api_key: ${{ secrets.TF_PUBLIC_API_KEY }}
git_ref: "main"
tmt_plan_regex: "secrets_plan"
pull_request_status_name: "Secrets test"
secrets: "SOME_DUMMY_SECRET=FOO_BAR_SECRET;OS_SECRET=DUMMY_SECRET_OS"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/timeout-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
id: tf_results
with:
api_key: ${{ secrets.TF_PUBLIC_API_KEY }}
git_ref: "main"
tmt_plan_regex: "timeout_plan"
pull_request_status_name: "Timeout test"
update_pull_request_status: "true"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/variables_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
uses: ./
with:
api_key: ${{ secrets.TF_PUBLIC_API_KEY }}
git_ref: "main"
tmt_plan_regex: "variables_plan"
pull_request_status_name: "Variables test"
variables: "SOME_DUMMY_VARIABLE=FOO_BAR_VARIABLE;OS_VARIABLE=DUMMY_OS"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ See [Testing Farm onboarding guide](https://docs.testing-farm.io/Testing%20Farm/
| Input Name | Description | Default value |
|------------|-------------|---------------|
| `git_url` | An url to the repository with tmt metadata | url of repo that runs GHA |
| `git_ref` | A tmt tests branch which will be used for tests | master |
| `git_ref` | A tmt tests branch, tag or commit specifying the desired git revision which will be used for tests | `github.ref` when available, otherwise `master` |
| `tmt_plan_regex` | A regular expression used to select tmt plans | all |
| `tmt_context` | A mapping of tmt context variable [tmt-context](https://tmt.readthedocs.io/en/latest/spec/context.html), variables separated by ; | empty |
| `tmt_path` | A path in the repository with tmt metadata | "." |
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ inputs:
required: false
default: '${{ github.server_url }}/${{ github.repository }}'
git_ref:
description: 'A TMT tests branch which will be used for tests'
description: 'A tmt tests branch, tag or commit specifying the desired git revision which will be used for tests.'
required: false
default: 'master'
default: '${{ github.ref }}'
github_token:
description: 'GitHub TOKEN or PAT'
required: false
Expand Down
4 changes: 3 additions & 1 deletion 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.

4 changes: 3 additions & 1 deletion 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: 4 additions & 1 deletion src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,16 @@ async function action(pr: PullRequest): Promise<void> {
JSON.parse(getInput('pipeline_settings'))
);

const ref = getInput('git_ref') || 'master';
debug(`Using git_ref: '${ref}'`);

// Schedule a test on Testing Farm
const request = {
api_key: getInput('api_key', { required: true }),
test: {
fmf: {
url: getInput('git_url', { required: true }),
ref: getInput('git_ref'),
ref,
path: tmtPath,
...tmtPlanRegex,
},
Expand Down

0 comments on commit b8fe742

Please sign in to comment.