-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically alphabetise antora yaml after changes #173
Conversation
35eedcc
to
a99bbef
Compare
🙈 The PR is closed and the preview is expired. |
Co-authored-by: George Gastaldi <[email protected]>
.github/workflows/alphabetise.yml
Outdated
- name: Alphabetise | ||
id: alpha | ||
uses: mikefarah/yq@master | ||
with: | ||
path: antora-playbook.yml | ||
cmd: '.content.sources |= sort_by(.url)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think GitHub already comes with yq
installed, so I don't think we need this action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that would be handy. There's a zillion actions for installing it, which is a bit pointless if it already has it. But let's try it without it first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not found, maybe use this action to install it, since we're already using it in our Quarkiverse extensions: https://github.com/quarkiverse/quarkus-ironjacamar/blob/main/.github/workflows/quarkus-snapshot.yaml#L37-L38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jq
for sure. yq
I'm not sure at all.
git checkout -b alpha-${{ github.run_id }} | ||
git add antora-playbook.yml | ||
git commit -m "Automatic alphabetisation" | ||
git push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to push explicitly, as gh pr create
below already does that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolves #161.
As always with workflow changes, this is hard to test. I de-sorted a local copy of the yaml and have run my script locally on the current yaml file. The output is included in this PR. You can see it tidied up a few trailing whitespaces, which is no bad thing, IMO. The comment removal was mine, since I didn't think we needed it anymore.
After sorting, the script raises a PR with changes. We could use something like https://github.com/marketplace/actions/git-auto-commit instead, but I thought we should start cautious. :)
After merging, I expect this will run successfully, but not create any PRs. To get the first PR, we'll need to wait for the next extension which adds documentation (and gets the order wrong).