Skip to content
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

[GitHub Actions API] Date range syntax not working for query parameter #2195

Open
1 task done
iamazeem opened this issue Feb 13, 2023 · 2 comments
Open
1 task done

Comments

@iamazeem
Copy link

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository

What part(s) of the article would you like to see updated?

Under List workflow runs for a repository, for the query parameter created, the date range syntax has been linked i.e. Query for dates:

# syntax
created:<START-DATE>..<END-DATE>

# example
created:2023-02-10..2023-02-12

But, this doesn't work.

The syntax that works is with =:

created=<START-DATE>..<END-DATE>
created=2023-02-10..2023-02-12

Example

Tested with a public repo like this (created:2023-02-12..2023-02-13):

curl \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  "https://api.github.com/repos/iamazeem/test/actions/runs?created:2023-02-12..2023-02-13" \
  | jq .total_count

# output: 8

Also, tested with other ranges and it always returns the total number of workflows runs i.e. 8 (at the time of writing).

However, it returns the correct number of workflows when tested with = (created=2023-02-12..2023-02-13):

curl \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  "https://api.github.com/repos/iamazeem/test/actions/runs?created=2023-02-12..2023-02-13" \
  | jq .total_count

# output: 3

The same has been tested and verified with multiple ranges with : and =.
And, = always work.

Seems like the syntax with : works for GitHub directly:

https://github.com/search?utf8=%E2%9C%93&q=cats+pushed%3A2016-04-30..2016-07-04&type=Repositories

But, it doesn't work for GHA API.

Maybe, the article needs to be updated or the link needs to be fixed.

Additional information

No response

@docubot
Copy link

docubot commented Feb 13, 2023

Thank you for opening this issue! Changes to the REST API schema can be requested in github/rest-api-description. I will transfer your issue over to that open source repo.

@docubot docubot transferred this issue from github/docs Feb 13, 2023
@cmwilson21
Copy link

@iamazeem Thanks for opening an issue! This request has been transferred over to the github/rest-api-description repo where it will be reviewed 👍

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

No branches or pull requests

5 participants
@iamazeem @becco @docubot @cmwilson21 and others