octokit / graphql-action Goto Github PK
View Code? Open in Web Editor NEWA GitHub Action to send queries to GitHub's GraphQL API
Home Page: https://github.com/marketplace/actions/github-graphql-api-query
License: MIT License
A GitHub Action to send queries to GitHub's GraphQL API
Home Page: https://github.com/marketplace/actions/github-graphql-api-query
License: MIT License
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Location: package.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: author, Invalid configuration option: keywords, Invalid configuration option: license, Invalid configuration option: main, Invalid configuration option: name, Invalid configuration option: packageRules[0].@actions/core, Invalid configuration option: packageRules[0].@octokit/action, Invalid configuration option: packageRules[1].@semantic-release/git, Invalid configuration option: packageRules[1].@zeit/ncc, Invalid configuration option: packageRules[1].js-yaml, Invalid configuration option: packageRules[1].semantic-release, Invalid configuration option: private, Invalid configuration option: release, Invalid configuration option: renovate, Invalid configuration option: scripts, Invalid configuration option: version
Hi,
So glad to see this, may I know how to check workflow runs by thisοΌ
Please consider bumping version of '@actions/core' dependency? Github recommends using 1.10.0
of @actions/core
.
No response
No response
No response
I'm trying to parse the comments of issues, and label an issue if certain words are found. I'm using a query to get the comments of issues in the first step of my workflow, and a second step applies the label using the output.
The documentation for this action says that if I want to pass the output of a graphql query to another step, I should
To access deep values of outputs.data, use fromJSON()
but I can't figure out a way to do this that doesn't break in some way. Here's what I have currently:
apply-issue-label:
name: Apply label if needed
steps:
- uses: octokit/[email protected]
name: Get the text of the issue and any of its comments
id: get_issue_text
with:
query: |
query getIssues($number: Int!, $owner: String!, $repo: String!) {
repository(name: $repo, owner: $owner) {
issue(number: $number) {
body
comments(last: 100) {
nodes {
body
}
}
}
}
}
variables: |
owner: ${{ github.event.repository.owner.login }}
repo: ${{ github.event.repository.name }}
number: ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/github-script@v6
name: Parse issue comments
with:
script: |
# This fails because the ${{ }} is literally substituted with the word `Array` before execution. Not sure why this is...
const comments = ${{ fromJSON(steps.get_issue_text.outputs.data).repository.issue.comments.nodes }}
console.log(comments)
# This will also most likely fail because again the ${{ }} literally replaces what is in the issue body. If a malicious user puts in the right snippet of code, they can execute it here.
const issueBody = ${{ fromJSON(steps.get_issue_text.outputs.data).repository.issue.body }}
console.log(issueBody)
let text = comments.map(({body}) => body)
text.push(issueBody)
What's the right way to pass the JSON output from the first step to the second step for handling? I'd really like just the first step's JSON output as an Object
in the second step.
JSON.parse(${{ steps.get_issue_text.outputs.data }})
fails because the argument is replaced with the literal output of get_issue_text
, which isn't valid JS.JSON.parse(`${{ steps.get_issue_text.outputs.data }}`)
almost works, but will fail if there are newlines in the data, which aren't allowed in JSON, and will also fail if the data contains `
.${{ steps.get_issue_text.outputs.data }}
doesn't work; spaces aren't allowed"${{ steps.get_issue_text.outputs.data }}"
doesn't work because the GraphQL response contains "
, causing a syntax errorNo response
No response
No response
See https://github.com/octokit/graphql-action/runs/691058363#step:8:23
Happy to accept a pull request to fix the problem, I don't have the time to investigate myself right now
master
branch failed. π¨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. Iβm sure you can resolve this πͺ.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those donβt help, or if this issue is reporting something you think isnβt right, you can always ask the humans behind semantic-release.
semantic-release cannot push the version tag to the branch master
on remote Git repository with URL https://x-access-token:[secure]@github.com/octokit/graphql-action
.
Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment and make sure the repositoryUrl is configured with a valid Git URL.
Good luck with your project β¨
Your semantic-release bot π¦π
Hi, i like your client for github, but i'm struggling to pass the accept parameter on header in order to use packages-preview api.
I've tried different approaches but i can't put it working.
Maybe if you put some examples how to customize the header on your documentation.
Best Regards,.
I'd like to be able to query mergeStateStatus
from the PullRequest
object however to do so, I need to set the Accept
header to application/vnd.github.merge-info-preview+json
(docs).
I'm not sure of the best way to achieve this, but I imagine that it would be either to expose an additional input such as headers
/accept_header
or maybe even something via the env
?
Thanks!
No response
No response
No response
Using this query
- uses: octokit/[email protected]
id: doc_info
with:
query: |
query doc_info($owner: String!, $repo: String!, $pr_number: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr_number) {
commits(first: 10) {
edges {
node {
commit {
oid
message
}
}
}
}
}
}
}
owner: ${{ github.event.repository.owner.name }}
repo: ${{ github.event.repository.name }}
pr_number: $ {{ github.event.pull_request.number }}
I am getting this error:
##[error]Variable $pr_number of type Int! was provided invalid value
##[error]Node run failed with exit code 1
How can I deal with it?
I don't see any casting to number method in the github context expression documentation
We have an action that takes a partial git SHA and resolves it to the complete SHA of a commit using a graphql query.
- name: Get full git sha
uses: octokit/[email protected]
with:
query: |
query getFullCommitSha($owner: String!, $repo: String!, $sha: String!) {
repository(owner: $owner, name: $repo) {
object(expression: $sha) {
oid
}
}
}
owner: "${{ github.event.repository.owner.login }}"
repo: "${{ github.event.repository.name }}"
sha: "${{ steps.prior-step.outputs.partialCommitSha }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
This works fine for most SHAs but whenever a SHA can be interpreted as number, the action fails. We first noticed this with a SHA that was an exponent number e.g. 1234e3
. For this case it was sufficient to add escaped qoutes to the SHA parameter in the YAML file i.e. sha: "\"${{ steps.prior-step.outputs.partialCommitSha }}\""
.
However for purely numeric SHA substrings, the action still parses the string as an integer with no clearly documented way of preventing this behavior.
For now we use interpolation in the query itself, without using variables to get the correct behavior:
- name: Get full git sha
uses: octokit/[email protected]
with:
query: |
query getFullCommitSha {
repository(owner: "${{ github.event.repository.owner.login }}", name: "${{ github.event.repository.name }}") {
object(expression: "${{ steps.prior-step.outputs.partialCommitSha }}") {
oid
}
}
}
octokit/[email protected]
##[debug]....Evaluating String:
##[debug]....=> 'partialCommitSha'
##[debug]..=> '05202765'
##[debug]=> '"05202765"'
##[debug]Result: '"05202765"'
Warning: Unexpected input(s) 'owner', 'repo', 'sha', valid inputs are ['query']
##[debug]Loading env
Run octokit/[email protected]
query getFullCommitSha($owner: String!, $repo: String!, $sha: String!) {
repository(owner: $owner, name: $repo) {
object(expression: $sha) {
oid
}
}
}
> owner: ...
> repo: ...
> sha: 5202765
##[debug]GraphqlResponseError: Request failed due to following response errors:
##[debug] - Variable $sha of type String! was provided invalid value
##[debug] at /home/runner/work/_actions/octokit/graphql-action/v2.2.23/dist/index.js:15207:13
##[debug] at processTicksAndRejections (node:internal/process/task_queues:96:5)
##[debug] at async main (/home/runner/work/_actions/octokit/graphql-action/v2.2.23/dist/index.js:1057:18) {
Looking for an example that retrieves all pages of a query
The @zeit/ncc
package is deprecated and it needs to consume @vercel/ncc
:
latest
No response
Creating a new action with the minimal example and variables
as listed in the README.md fails with the following error:
Error: Request failed due to following response errors:
- Variable $owner of type String! was provided invalid value
- Variable $repo of type String! was provided invalid value
Specifically, code as follows:
on:
push:
branches:
- main
jobs:
logLatestRelease:
runs-on: ubuntu-latest
steps:
- uses: octokit/[email protected]
id: get_latest_release
with:
query: |
query release($owner:String!,$repo:String!) {
repository(owner:$owner,name:$repo) {
releases(first:1) {
nodes {
name
createdAt
tagName
description
}
}
}
}
variables: |
owner: ${{ github.event.repository.owner.name }}
repo: ${{ github.event.repository.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: "echo 'latest release: ${{ steps.get_latest_release.outputs.data }}'"
octokit/[email protected]
Run octokit/[email protected]
with:
query: query release($owner:String!,$repo:String!) {
repository(owner:$owner,name:$repo) {
releases(first:1) {
nodes {
name
createdAt
tagName
description
}
}
}
}
variables: owner: myorg
repo: github-project-playground
env:
GITHUB_TOKEN: ***
query release($owner:String!,$repo:String!) {
repository(owner:$owner,name:$repo) {
releases(first:1) {
nodes {
name
createdAt
tagName
description
}
}
}
}
> variables: [object Object]
> mediaType: undefined
Error: Request failed due to following response errors:
- Variable $owner of type String! was provided invalid value
- Variable $repo of type String! was provided invalid value
master
branch failed. π¨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. Iβm sure you can resolve this πͺ.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those donβt help, or if this issue is reporting something you think isnβt right, you can always ask the humans behind semantic-release.
semantic-release cannot push the version tag to the branch master
on the remote Git repository with URL https://x-access-token:[secure]@github.com/octokit/graphql-action
.
This can be caused by:
Good luck with your project β¨
Your semantic-release bot π¦π
See my snippet at https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/blob/main/.github/workflows/check-packages.yml#L119
- name: Get Admin-Server GH Package URL
uses: octokit/[email protected]
id: get_latest_pkg_admin
with:
query: |
query packages($owner:String!,$repo:String!) {
repository(owner:${{ env.OWNER }},name:${{ env.REPO }}) {
# /!\ '_' dash char. NOT supported in org.springframework.samples.petclinic.admin.${{ env.PRJ_PREFIX }}-${{ env.ADMIN_SERVER }}
packages(first: 10, packageType: MAVEN, names: "org.springframework.samples.petclinic.admin.aca-spring-petclinic-admin-server") {
edges {
node {
id
name
packageType
versions(first: 100) {
nodes {
id
version
files(first: 10) {
nodes {
name
url
}
}
}
}
}
}
}
}
}
# owner: ${{ github.repository_owner }} # ${{ github.event.repository.owner.name }}
# repo: ${{ github.event.repository.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.PKG_PAT }}
OWNER: ${{ github.repository_owner }} # # ${{ github.event.repository.owner.name }}
REPO: ${{ github.event.repository.name }}
The query works fine in the GraphQL Explorer but the Runner fails with :
##[debug]Evaluating: secrets.GITHUB_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'GITHUB_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: github.repository_owner
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'repository_owner'
##[debug]=> 'ezYakaEagle44[2](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:2)'
##[debug]Result: 'ezYakaEagle442'
##[debug]Evaluating: github.event.repository.name
##[debug]Evaluating Index:
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating github:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'event'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'repository'
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'name'
##[debug]=> 'aca-java-petclinic-mic-srv'
##[debug]Result: 'aca-java-petclinic-mic-srv'
##[debug]Evaluating condition for step: 'Get Admin-Server GH Package URL'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Get Admin-Server GH Package URL
##[debug]Loading inputs
##[debug]Evaluating: format('query packages($owner:String!,$repo:String!) {{
##[debug] repository(owner:{0},name:{1}) {{
##[debug] # /!\ ''_'' dash char. NOT supported in org.springframework.samples.petclinic.admin.{2}-{[3](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:3)}
##[debug] packages(first: 10, packageType: MAVEN, names: "org.springframework.samples.petclinic.admin.aca-spring-petclinic-admin-server") {{
##[debug] edges {{
##[debug] node {{
##[debug] id
##[debug] name
##[debug] packageType
##[debug] versions(first: 100) {{
##[debug] nodes {{
##[debug] ' packages(first: 10, packageType: MAVEN, names: "org.springframework.samples.petclinic.admin.aca-spring-petclinic-admin-server") {\n' +
##[debug] ' edges {\n' +
##[debug] ' node {\n' +
##[debug] ' id\n' +
##[debug] ' name\n' +
##[debug] ' packageType\n' +
##[debug] ' versions(first: 100) {\n' +
##[debug] ' nodes {\n' +
##[debug] ' id\n' +
##[debug] ' version\n' +
##[debug] ' files(first: 10) {\n' +
##[debug] ' nodes {\n' +
##[debug] ' name\n' +
##[debug] ' url\n' +
##[debug] ' }\n' +
##[debug] ' }\n' +
##[debug] ' }\n' +
##[debug] ' }\n' +
##[debug] ' }\n' +
##[debug] ' }\n' +
##[debug] ' }\n' +
##[debug] ' }\n' +
##[debug] '}\n'
##[debug] },
##[debug] headers: {
##[debug] 'access-control-allow-origin': '*',
##[debug] 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
##[debug] connection: 'close',
##[debug] 'content-encoding': 'gzip',
##[debug] 'content-security-policy': "default-src 'none'",
##[debug] 'content-type': 'application/json; charset=utf-8',
##[debug] date: 'Tue, 0[4](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:4) Oct 2022 14:26:02 GMT',
##[debug] 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
##[debug] server: 'GitHub.com',
##[debug] 'strict-transport-security': 'max-age=31[5](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:5)3[6](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:6)000; includeSubdomains; preload',
##[debug] 'transfer-encoding': 'chunked',
##[debug] vary: 'Accept-Encoding, Accept, X-Requested-With',
##[debug] 'x-content-type-options': 'nosniff',
##[debug] 'x-frame-options': 'deny',
##[debug] 'x-github-media-type': 'github.v3; format=json',
##[debug] 'x-github-request-id': '0401:563F:FDCF62:20[7](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:7)6C[8](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:8)F:633C427A',
##[debug] 'x-ratelimit-limit': '1000',
##[debug] 'x-ratelimit-remaining': '1000',
##[debug] 'x-ratelimit-reset': '16648[9](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:9)7[16](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:16)2',
##[debug] 'x-ratelimit-resource': 'graphql',
##[debug] 'x-ratelimit-used': '0',
##[debug] 'x-xss-protection': '0'
##[debug] },
##[debug] response: { errors: [ [Object] ] },
##[debug] errors: [
##[debug] {
##[debug] message: 'Parse error on "-" (error) at [2, [43](https://github.com/ezYakaEagle442/aca-java-petclinic-mic-srv/actions/runs/3182911312/jobs/5189509349#step:4:43)]',
##[debug] locations: [Array]
##[debug] }
##[debug] ],
##[debug] data: undefined
##[debug]}
Error: Request failed due to following response errors:
- Parse error on "-" (error) at [2, 43]
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Get Admin-Server GH Package URL
Using the following Action config, I get the error "Variable $itemId of type ID! was provided invalid value"
- uses: octokit/[email protected]
with:
query: |
mutation setToReleased($itemId:ID!) {
updateProjectV2ItemFieldValue(input: {fieldId: "PVTSSF_XXXXXXX", itemId: $itemId, projectId: "PVT_YYYYYYYYY", value: {text: "π Released"}}) {
projectV2Item {
updatedAt
}
}
}
itemId: ${{ fromJson(steps.milestone_issues.outputs.data).repository.milestone.issues.nodes[0].id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The same query works with a "string" parameter works as expected in the GitHub GraphQL API Explorer
v2.x
Warning: Unexpected input(s) 'itemId', valid inputs are ['query']
Run octokit/graphql-action@v[2](https://github.com/TeamConnectr/github-testing/actions/runs/3705750204/jobs/6280063209#step:5:2).x
with:
query: mutation setToReleased($itemId:ID!) {
updateProjectV2ItemFieldValue(input: {fieldId: "PVTSSF_XXXXXXXXX", itemId: $itemId, projectId: "PVT_YYYYYYYYY", value: {text: "π Released"}}) {
projectV2Item {
updatedAt
}
}
}
itemId: I_ZZZZZZZZZ
env:
GITHUB_TOKEN: ***
This happened around Jul 08, 2022, 2:17 PM EDT. octokit/graphql-action
just suddenly stopped working with the following errors:
Run octokit/[email protected]
with:
query: {
repository(owner: "<github owner>", name: "<github repo>") {
object(oid: "<a commit sha>") {
... on Commit {
message
author {
user {
login
}
email
}
committer {
user {
login
}
}
}
}
}
}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.8.13/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.13/x64/lib
GITHUB_TOKEN: ***
internal/fs/utils.js:269
throw err;
^
Error: ENOENT: no such file or directory, open '/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/bridge.js'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at Object.<anonymous> (/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/index.js:26968:60)
at __webpack_require__ (/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/index.js:24:31)
at Object.<anonymous> (/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/index.js:34426:5)
at __webpack_require__ (/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/index.js:24:31)
at Object.<anonymous> (/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/index.js:9432:18)
at __webpack_require__ (/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/index.js:24:31)
at Object.<anonymous> (/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/index.js:25686:15)
at __webpack_require__ (/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/index.js:24:31) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/runner/work/_actions/octokit/graphql-action/v2.x/dist/bridge.js'
}
We didn't make any code change related to how we use octokit/graphql-action
, can anyone take a look? Thanks!
Just for consistency with the rest of the projects of the ecosystem
When running a query using the gh api graphql call the values in arrays are visible after the query runs. The query is written to check the ProjectV2ItemFieldIterationValue for an Issue, then have the ability to recall the value later in the action.
The issue in question is a member of a Project with a Iteration custom field.
Example using gh api graphql:
gh api graphql -f query='query get_story_and_iteration {
user(login: "kevinmcct") {
repository(name: "GitHub-action-test") {
issue(number: 34) {
projectItems(first: 1) {
nodes {
fieldValueByName(name: "Sprint") {
... on ProjectV2ItemFieldIterationValue {
title
}
}
}
}
}
}
}
}' > sprint.json
cat sprint.json
{"data":{"repository":{"issue":{"title":"new issues with auto #34 12345678","projectItems":{"nodes":[{"fieldValueByName":{"title":"Sprint 2"}}]}}}}}
When running the same query using octokit/[email protected] in an action the query runs with no errors, but when trying to view the data returned by the query I can't see the data past the nodes [] section of the output data.
Example running octokit/[email protected]:
Run octokit/[email protected]
with:
query: query sprint ($owner:String!,$repo:String!,$gh_issue_number:Int!){
user(login: $owner) {
repository(name: $repo) {
issue(number: $gh_issue_number) {
projectItems(first: 1) {
nodes {
iteration:fieldValueByName(name: "Sprint") {
... on ProjectV2ItemFieldIterationValue {
title
}
}
}
}
}
}
}
}
owner: kevinmcct
repo: GitHub-action-test
gh_issue_number: [3](https://github.com/kevinmcct/GitHub-action-test/actions/runs/3183587445/jobs/5190984944#step:2:3)[4](https://github.com/kevinmcct/GitHub-action-test/actions/runs/3183587445/jobs/5190984944#step:2:4)
env:
GITHUB_TOKEN: ***
query sprint ($owner:String!,$repo:String!,$gh_issue_number:Int!){
user(login: $owner) {
repository(name: $repo) {
issue(number: $gh_issue_number) {
projectItems(first: 1) {
edges {
node {
iteration:fieldValueByName(name: "Sprint") {
... on ProjectV2ItemFieldIterationValue {
title
}
}
}
}
}
}
}
}
}
> owner: kevinmcct
> repo: GitHub-action-test
> gh_issue_number: [34](https://github.com/kevinmcct/GitHub-action-test/actions/runs/3183587445/jobs/5190984944#step:2:35)
Run echo 'Sprint Name: {
Sprint Name: {
"user": {
"repository": {
"issue": {
"projectItems": {
"nodes": []
}
}
}
}
}
Am I missing some additional information when trying to recall the information or is there something strange happening in my query?
Here is the action I am using:
name: Advanced Sync issue to Azure DevOps work item
on:
issues:
types:
[opened, edited, deleted, closed, reopened, labeled, unlabeled, assigned]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
graphQL:
runs-on: ubuntu-latest
steps:
- uses: octokit/[email protected]
id: sprint
with:
query: |
query sprint ($owner:String!,$repo:String!,$gh_issue_number:Int!){
user(login: $owner) {
repository(name: $repo) {
issue(number: $gh_issue_number) {
projectItems(first: 1) {
nodes {
fieldValueByName(name: "Sprint") {
... on ProjectV2ItemFieldIterationValue {
title
}
}
}
}
}
}
}
}
owner: kevinmcct
repo: ${{ github.event.repository.name }}
gh_issue_number: ${{ github.event.issue.number }}
- run: "echo 'Sprint Name: ${{ steps.sprint.outputs.data }}'"
One of our actions threw an error earlier today and the error message implied that it should be reported:
Error: Something went wrong while executing your query. Please include
0781:5AD4:240C07:892C2B:61CC49CB when reporting this issue.
The workflow looks like this:
steps:
- uses: octokit/[email protected]
with:
headers: '{"GraphQL-Features": "projects_next_graphql"}'
query: |
mutation add_to_project($projectid:ID!,$contentid:ID!) {
addProjectNextItem(input:{projectId:$projectid contentId:$contentid}) {
projectNextItem {
id
}
}
}
projectid: ${{ env.PROJECT_ID }}
contentid: ${{ github.event.issue.node_id }}
env:
PROJECT_ID: "PN_kwDOAM0swc1HvQ"
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
I re-ran the workflow and it worked on second pass without any issues so urgency to investigate further from our side.
I saw that here:
Lines 35 to 38 in 6ea3f9b
We are parsing the inputs using toLowerCase()
which results in providing the wrong query variable when executing it.
I don't know if it's expected or if it's already addressed but it is present in the latest release.
My below action fails:
name: Delete Discussion from outside collaborators
on:
discussion_comment:
types: [created]
jobs:
job1:
runs-on: ubuntu-latest
if: >
(github.event_name == 'discussion_comment') &&
(github.event.action == 'created') &&
(github.event.comment.user.id == github.event.discussion.user.id) &&
(github.event.comment.body == format('{0}{1}', 'DELETE MY POST ', github.event.discussion.title))
steps:
- name: Delete discussion through GitHub GraphQL API
uses: octokit/[email protected]
with:
query: |
mutation DeleteDiscussion($discussionId: ID!) {
deleteDiscussion(input: { id: $discussionId }) {
clientMutationId
}
}
discussionId: ${{ github.event.discussion.node_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Error: Variable $discussionId of type ID! was provided invalid value
This happens because since we're providing the discussionid
(note the lowercase) instead of discussionId
, the actual value sent to the query var is undefined or whatever but not the value provided in the action.
The workaround is to provide declare lowercase variables in the GraphQL query string itself:
name: Delete Discussion from outside collaborators
on:
discussion_comment:
types: [created]
jobs:
job1:
runs-on: ubuntu-latest
if: >
(github.event_name == 'discussion_comment') &&
(github.event.action == 'created') &&
(github.event.comment.user.id == github.event.discussion.user.id) &&
(github.event.comment.body == format('{0}{1}', 'DELETE MY POST ', github.event.discussion.title))
steps:
- name: Delete discussion through GitHub GraphQL API
uses: octokit/[email protected]
with:
query: |
- mutation DeleteDiscussion($discussionId: ID!) {
+ mutation DeleteDiscussion($discussionid: ID!) {
- deleteDiscussion(input: { id: $discussionId }) {
+ deleteDiscussion(input: { id: $discussionid }) {
clientMutationId
}
}
# optional change, since the input will be parsed as lowercase anyways.
- discussionId: ${{ github.event.discussion.node_id }}
+ discussionid: ${{ github.event.discussion.node_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: "The issue was deleted by the author and can't be restored anymore."
I'm also playing with this action less than an hour so let me know if I am missing something.
Thanks.
Any idea on what could be the issue here?
https://github.com/octokit/graphql-action/runs/7242724489?check_suite_focus=true
node20
is now supported as runner (run.using
in action.yml), as per https://github.com/actions/runner/releases/tag/v2.308.0
No response
No response
No response
This issue contains a list of Renovate updates and their statuses.
These updates are awaiting their schedule. Click on a checkbox to ignore the schedule.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.