Skip to content

How to create issues via an action #25698

How to create issues via an action #25698
Jun 30, 2021 · 5 answers

I was trying to create an GitHub action (here) that open an issue or at least adds a comment to an existing issue when an event occurs.
However, whenever I try to do it using curl, it says needs authentication. I tried authenticating to my account via ${{ secrets.GITHUB_TOKEN }} but I get an error.
What am I doing wrong?
I am not sure if this is the correct place to ask for help, but the docs did not provide any guidance.
Is this require something special or can it just be done via normal actions or the REST api?

Thank you!

Hi, firstly we wanted to mention actions/github-script, as it might help you in the future to make API calls easier:

  <a href="https://github.com/actions/github-script" target="_blank" rel="noopener">GitHub</a>

actions/github-script

Write workflows scripting the GitHub API in JavaScript - actions/github-script

For the error itself, we weren’t able to find the specific workflow run demonstrating this error, but most likely you could resolve this issue by using a PAT instead of the GITHUB_TOKEN:

https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

You can then add it as a secret, and use the secret in the wor…

Replies

5 suggested answers

Hi, firstly we wanted to mention actions/github-script, as it might help you in the future to make API calls easier:

  <a href="https://github.com/actions/github-script" target="_blank" rel="noopener">GitHub</a>

actions/github-script

Write workflows scripting the GitHub API in JavaScript - actions/github-script

For the error itself, we weren’t able to find the specific workflow run demonstrating this error, but most likely you could resolve this issue by using a PAT instead of the GITHUB_TOKEN:

https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

You can then add it as a secret, and use the secret in the workflow to make the API call:

https://docs.github.com/en/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow

0 replies
Answer selected

@github-support I am a bit busy, but I will look at that later.
Thank you for your help!

0 replies

I have found a solution.
Thanks!

0 replies

another option: it appears that the runners have the github cli installed on them by default

0 replies

@dradetsky Thanks!
I will look into GitHub cli!

0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants