Tests for kickstart script commands #313
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Run TMT test plans in the Testing Farm machines | |
# | |
# This could be also started locally if needed. Take a look into the plans directory. | |
# | |
name: Testing farm tests | |
on: | |
issue_comment: | |
types: | |
- created | |
jobs: | |
pr-info: | |
if: startsWith(github.event.comment.body, '/test-tmt') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Query comment author repository permissions | |
uses: octokit/[email protected] | |
id: user_permission | |
with: | |
route: GET /repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}/permission | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# restrict running of tests to users with admin or write permission for the repository | |
# see https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#get-repository-permissions-for-a-user | |
# store output if user is allowed in allowed_user job output so it has to be checked in downstream job | |
- name: Check if user does have correct permissions | |
if: contains('admin write', fromJson(steps.user_permission.outputs.data).permission) | |
id: check_user_perm | |
run: | | |
echo "User '${{ github.event.sender.login }}' has permission '${{ fromJson(steps.user_permission.outputs.data).permission }}' allowed values: 'admin', 'write'" | |
echo "allowed_user=true" >> $GITHUB_OUTPUT | |
outputs: | |
allowed: ${{ steps.check_user_perm.outputs.allowed_user }} | |
testingfarm: | |
name: "Run in testing farm" | |
needs: pr-info | |
runs-on: ubuntu-latest | |
environment: testing-farm | |
permissions: | |
contents: read | |
statuses: write | |
if: needs.pr-info.outputs.allowed == 'true' | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
ref: "refs/pull/${{ github.event.issue.number }}/head" | |
submodules: true | |
- name: Run the tests | |
uses: sclorg/testing-farm-as-github-action@main | |
with: | |
compose: Fedora-39 | |
api_key: ${{ secrets.TF_API_KEY }} | |
git_url: "https://github.com/${{ github.repository }}" | |
git_ref: "refs/pull/${{ github.event.issue.number }}/head" | |
path: "ansible" | |
tmt_plan_regex: "testing-farm" | |
pull_request_status_name: "kickstart tests" | |
update_pull_request_status: true | |
tf_scope: private | |
variables: "PR_NUMBER=${{ github.event.issue.number }}" |