~xenrox/hut

25ecf7f6 — Simon Martin 11 days ago
todo: add support for user preferences

This hooks up the new GraphQL queries and mutations linked to user
preferences for trackers, that have been added via
   https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/65987

Signed-off-by: Simon Martin <simon@nasilyan.com>
a6c7ff24 — Simon Martin a month ago
config: hub is another available service

hub is like man (that I addressed via [1]): it can legitimately be used
as a service in the `hut graphql`, and needs to be known to config.go.

[1] https://lists.sr.ht/~xenrox/hut-dev/patches/63878

Signed-off-by: Simon Martin <simon@nasilyan.com>
pages: Fix "go test" error

./pages.go:255:101: non-constant format string in call to (git.sr.ht/~xenrox/hut/termfmt.Style).Sprintf
Update schemata
Upgrade dependencies
lists preferences update: Fix behaviour

When not setting the "copy-self" flag, the current implementation fails:
  failure with "copy-self": strconv.ParseBool: parsing "": invalid syntax

Instead, check if the flag is set.

Furthermore, the implementation of PreferencesInput differs from e.g.
hg's RepoInput. For RepoInput the settings can get left out to remain
unchanged - they are pointers. In the case of PreferencesInput CopySelf
is not a pointer, so CopySelf has a default value of "false".
To correctly keep the current settings if no changes have been made, the
old settings need to be retrieved first. Like this the default values of
PreferencesInput can be set correctly.
3fe4a3d8 — Simon Martin a month ago
lists: add support for user preferences

This hooks up the new GraphQL queries and mutations linked to user
preferences for lists, that have been added via
  https://git.sr.ht/~sircmpwn/lists.sr.ht/commit/d33e46ff9da171fa103c00bc0369d4e3f72dca68

Related: https://todo.sr.ht/~sircmpwn/sourcehut/36
Signed-off-by: Simon Martin <simon@nasilyan.com>
f9707a7d — Simon Martin 2 months ago
builds: support filtering job list by tags

This improves the filtering capabilities in `hut builds list` by adding
support for tags.

Since a build triggered by a push to ~simartin/sr.ht-integration-testing
will actually have four tags (sr.ht-integration-testing, commits, master
and .build.yml) that are displayed slash separated in the UI and hut, it
does not make much sense to do a full equality check, and I decided to
do a prefix match.

Signed-off-by: Simon Martin <simon@nasilyan.com>
f047391c — Simon Martin 2 months ago
Correct handling of --count in list commands

The --count attribute is not properly handled: we only check if we've
done enough *after* writing the data for a full page of data from the
API, hence possibly write too much.

This patch keeps track of the number of items written, and stops
processing as soon as it's equal to the count requested by the user, if
any.

Signed-off-by: Simon Martin <simon@nasilyan.com>
d1f59be5 — Simon Martin 2 months ago
builds: preserve job tags when resubmitting without edit

This is the equivalent of the builds.sr.ht fix at [1], but for hut that
has the same problem.

[1] https://git.sr.ht/~sircmpwn/builds.sr.ht/commit/c72e1d52c2c74696c87ce7f18a577583ed6f6dab

Signed-off-by: Simon Martin <simon@nasilyan.com>
5b8ce2b2 — Simon Martin 2 months ago
config: man is another available service

I noticed the following error when playing with `hut graphql` in
sr.ht-container-compose:
  $ echo "{ version { major, minor, patch } }" | myhutcc graphql man
  failed to load config file: line 24, directive "man": unknown directive

The problem is that setting up man in
  https://git.sr.ht/~whynothugo/sr.ht-container-compose/tree/main/item/hut-config
does not work, while it should, like the other services.

With this patch, things work as expected:
  $ echo "{ version { major, minor, patch } }" | myhutcc graphql man
  {
    "version": {
      "major": 0,
      "minor": 0,
      "patch": 0
    }
  }

Signed-off-by: Simon Martin <simon@nasilyan.com>
93aef519 — Simon Martin 4 months ago
webhook: improve webhook creation --query parameter

This follow-up to 5e75e022 addresses the suggestions made in the review
for that commit, namely (1) deactivates completion for the --query
parameter and (2) mentions it in the documentation.

Fixes: 5e75e022 ("webhook: support passing the query as a command line parameter")
Suggested-by: Thorben Günther <admin@xenrox.net>
Signed-off-by: Simon Martin <simon@nasilyan.com>
todo: Remove unnecessary nil checks
Update schemata
Update todo schema
update_schemas: Add schemata for hub and man
5e75e022 — Simon Martin 4 months ago
webhook: support passing the query as a command line parameter

All the "hut XYZ webhook create" commands require the user to provide a
GQL query, either via stdin or an invocation of $EDITOR.

This makes scripting unnecessarily tedious, and this patch adds a
"--query" parameter to those commands, exclusive with "--stdin".

Signed-off-by: Simon Martin <simon@nasilyan.com>
deca20ce — Simon Martin 4 months ago
config: expand ~/ in configuration file

hut fails when invoked with something like "hut --config=~/conf ..."
because the ~ is not expanded:
   failed to load config file: open ~/conf: no such file or directory

This adds this expansion.

Signed-off-by: Simon Martin <simon@nasilyan.com>
Next