Skip to content

GitHub Action and GitLab CI/CD Component#232

Open
gronke wants to merge 7 commits into
collective:masterfrom
gronke:feat/setup-zpretty-action
Open

GitHub Action and GitLab CI/CD Component#232
gronke wants to merge 7 commits into
collective:masterfrom
gronke:feat/setup-zpretty-action

Conversation

@gronke

@gronke gronke commented Jun 10, 2026

Copy link
Copy Markdown

Reusable GitHub Action and GitLab CI/CD Component for zpretty for easy wiring in common CI runners.

@gronke gronke force-pushed the feat/setup-zpretty-action branch from fc894fd to 089a282 Compare June 10, 2026 12:36
@gronke

gronke commented Jun 10, 2026

Copy link
Copy Markdown
Author

Seen in action here: https://github.com/radicallyopensecurity/pentext/actions/runs/27278270476/job/80565303330?pr=160

@coveralls

coveralls commented Jun 10, 2026

Copy link
Copy Markdown

Coverage Status

Coverage is 96.929%gronke:feat/setup-zpretty-action into collective:master. No base build found for collective:master.

@ale-rt

ale-rt commented Jun 11, 2026

Copy link
Copy Markdown
Member

Thanks a lot @gronke for your amazing contributions!
Would you mind adding a changelog line in HISTORY.md and some lines in the README.md?

gronke added 3 commits June 11, 2026 10:06
Installs zpretty from a configurable spec; dogfooded by a workflow.
Add a Continuous integration section to the README with usage examples
for the composite action and the GitLab include, and replace the empty
4.0.3 changelog entry in HISTORY.md.
@gronke gronke force-pushed the feat/setup-zpretty-action branch from 089a282 to 39b2fe0 Compare June 11, 2026 11:30
@gronke

gronke commented Jun 11, 2026

Copy link
Copy Markdown
Author

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds reusable CI integration pieces so downstream projects can easily install and run zpretty in common CI runners (GitHub Actions and GitLab CI/CD), and documents how to use them.

Changes:

  • Add a composite GitHub Action for setting up zpretty, plus a GitHub Actions workflow to smoke-test it.
  • Add a reusable GitLab CI job template (.zpretty) and include it in packaging.
  • Document both CI integrations in README.md and note the addition in HISTORY.md.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
README.md Documents GitHub Actions and GitLab CI/CD usage for zpretty setup in CI.
MANIFEST.in Ensures the GitLab CI template YAML is included in source distributions.
HISTORY.md Records the addition of the CI integrations.
gitlab/zpretty.gitlab-ci.yml Provides a reusable .zpretty GitLab job template that installs and reports zpretty.
.github/workflows/zpretty-action.yml Adds a workflow to smoke-test the composite action by installing from the repo checkout and running zpretty --check.
.github/actions/zpretty/action.yml Implements the composite action that sets up Python and installs zpretty from a configurable spec.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines +147 to +149
- uses: actions/checkout@v6
- uses: collective/zpretty/.github/actions/zpretty@master
- run: zpretty --check path/to/file.xml

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.

The change of line 147 is wrong.
I agree about the use of <ref> but that should be explained.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Indeed v6 is the latest Action. One could think that Microsoft trains their models on the docs of their own services 🤔

The benefit of pointing at the default branch @master is that users can just copy-paste and use it. Otherwise one would need to remember what the default branch was called.

@ale-rt think we should change to @<ref>?

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.

If you look e.g. at https://github.com/actions/checkout#fetch-only-the-root-files they are pointing to a version.
This of course means that once the version is upgraded the docs should be upgraded as well.

Using <ref> and adding to the docs a note about that might be the mvp.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ah, I see. You mean to pin the currently latest version in the readme, not <rev>. Makes sense to pin a version, so that linting behavior does not change unexpectedly across repeated builds.

Want to add a drift test for the readme?

Comment thread README.md Outdated

```yaml
include:
- remote: "https://raw.githubusercontent.com/collective/zpretty/master/gitlab/zpretty.gitlab-ci.yml"

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.

I agree about the use of but that should be explained.

Comment thread .github/workflows/zpretty-action.yml
Comment thread .github/actions/zpretty/action.yml
Comment on lines +13 to +15
before_script:
- pip install "$ZPRETTY_SPEC"
- zpretty --version

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.

I am +0 on this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The Python environment should need to bother us here, because if Pip fails installing zpretty, it probably also fails upgrading itself.

Comment thread gitlab/zpretty.gitlab-ci.yml Outdated
ZPRETTY_PYTHON_VERSION: "3"
ZPRETTY_SPEC: zpretty
before_script:
- pip install "$ZPRETTY_SPEC"

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.

The GH action looks like:

        python -m pip install --upgrade pip
        python -m pip install "${{ inputs.spec }}"

Maybe we should have the same here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

As mentioned on the Action, I am leaning to remove the pip upgrade, unless you prefer to upgrade it here as well.

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.

I have no hard preference.

Comment thread README.md
```

The action takes two optional inputs: `spec`, a pip requirement specifier
(a release such as `zpretty==4.0.2`, a VCS URL, or `.` to install the

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.

I do not see the reason of checking out a zpretty and then using a spec different from .

gronke and others added 4 commits June 12, 2026 10:38
Drop the pip self-upgrade from the composite action: if pip cannot
install zpretty it will hardly succeed in upgrading itself first. Use
`python -m pip` in the GitLab template too, so both runners install with
the identical one-liner.
Replace the hardcoded `master` in the GitHub Action and GitLab include
examples with the `4.0.3` release tag, the first one that will ship the
action and the template. Copy-pasted pipelines are then pinned, so the
formatting behavior does not change unexpectedly between runs; a note
explains that any other git reference (a newer tag, a commit SHA, or
`master`) works as well. Also clarify that the checkout step in the
Action example checks out the consumer repository, not zpretty itself.
Assert that both CI examples pin the same version and that it is either
the latest released version or the upcoming one from HISTORY.md. The
test stays quiet during a normal development cycle, where the README
keeps pointing at the latest release, and fails as soon as the pin falls
a full release behind.
github, gitlab = self.extract_pinned_versions_from_readme()
self.assertEqual(github, gitlab)
topmost, latest_released = self.extract_versions_from_history()
self.assertIn(github, (topmost, latest_released))

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.

I think this test is a pain to keep it running and not very comprehensive.
As you can see in the README you still have a mixture of 4.0.2 and 4.0.3.

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.

4 participants