Skip to content

Add XML validation workflow using GitHub Actions#454

Merged
lsm5 merged 1 commit intomainfrom
xmllint-validation-1
Apr 21, 2026
Merged

Add XML validation workflow using GitHub Actions#454
lsm5 merged 1 commit intomainfrom
xmllint-validation-1

Conversation

@lsm5
Copy link
Copy Markdown
Member

@lsm5 lsm5 commented Apr 20, 2026

Summary by Sourcery

CI:

  • Introduce a GitHub Actions workflow that triggers Testing Farm to run the xmllint_validation tmt plan on main branch pushes, pull requests, and workflow_dispatch.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 20, 2026

Reviewer's Guide

Adds a new GitHub Actions workflow that runs Testing Farm’s xmllint-based validation for XML-related tmt plans on pushes, pull requests, and manual dispatches to the main branch.

File-Level Changes

Change Details Files
Introduce a CI workflow to run Testing Farm xmllint validation for the repository.
  • Create a GitHub Actions workflow triggered on push, pull_request, and workflow_dispatch events targeting the main branch
  • Configure the workflow to check out the repository code before running tests
  • Integrate the sclorg/testing-farm-as-github-action@v2 action to schedule xmllint validation on Testing Farm using a dedicated tmt plan matched by regex
  • Pass required secrets and GitHub context (Testing Farm API key, repository URL, ref, and GitHub token) to the Testing Farm action
.github/workflows/xmllint-validation.yml

Possibly linked issues

  • #CI: Run xmllint on every PR: PR adds an xmllint GitHub Actions workflow, fulfilling the request to run xmllint on every PR.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@lsm5 lsm5 force-pushed the xmllint-validation-1 branch from a8bb41b to 75d9491 Compare April 20, 2026 18:17
@packit-as-a-service
Copy link
Copy Markdown

Tests failed. @containers/packit-build please check.

@lsm5 lsm5 marked this pull request as ready for review April 20, 2026 19:21
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • On pull_request events github.ref points to refs/pull/... rather than the merge or head SHA; if Testing Farm expects a commit-ish, consider using git_ref: ${{ github.sha }} or github.event.pull_request.head.sha to ensure the correct revision is tested.
  • The workflow currently runs on every push and PR to main; if the XML validation is only relevant for certain files, consider adding a paths filter under on: to avoid unnecessary remote runs.
  • To follow GitHub Actions least-privilege practices, consider explicitly setting permissions: for this workflow (e.g. contents: read and only what the Testing Farm action actually needs) instead of relying on the default token permissions.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- On pull_request events `github.ref` points to `refs/pull/...` rather than the merge or head SHA; if Testing Farm expects a commit-ish, consider using `git_ref: ${{ github.sha }}` or `github.event.pull_request.head.sha` to ensure the correct revision is tested.
- The workflow currently runs on every push and PR to main; if the XML validation is only relevant for certain files, consider adding a `paths` filter under `on:` to avoid unnecessary remote runs.
- To follow GitHub Actions least-privilege practices, consider explicitly setting `permissions:` for this workflow (e.g. `contents: read` and only what the Testing Farm action actually needs) instead of relying on the default token permissions.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@lsm5
Copy link
Copy Markdown
Member Author

lsm5 commented Apr 20, 2026

@containers/container-selinux-maintainers PTAL. This (and perhaps similar future PRs) are a PoC for switching to a GHA + TMT/testing-farm workflow given that Cirrus CI will be shutting down on Jun 1.

I'm told GHA actions first need to be merged to main in order for them to take effect on future PRs from forks.

@jankaluza
Copy link
Copy Markdown
Member

LGTM.

@lsm5 lsm5 merged commit 422f175 into main Apr 21, 2026
31 of 32 checks passed
@lsm5 lsm5 deleted the xmllint-validation-1 branch April 21, 2026 12:16
name: "XML Validation"

on:
pull_request:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is not correct, you cannot use secrets on this trigger as it would leak them to any user, as such github blocks them for PRs from forks.

so this only works because you created the PR from a branch instead of your fork like we normally do.
So any outside contributor will have that job fail due the missing secret.

The only way to use secrets on PRs is pull_request_target which will always use workflow file from the target branch not the PR itself so a contributor cannot chnage it to leak the key to themselves. However it is easy to screw that up so using pull_request_target and secrets is often considered insecure.

Comment on lines +17 to +20
uses: actions/checkout@v4

- name: Schedule tests on Testing Farm
uses: sclorg/testing-farm-as-github-action@v2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these importing outdated versions? There are newer major versions.

Also I think for security reasons we should start pinning these by commit sha, renovate will still be able tu update them like we see in podman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants