Replies: 4 comments 4 replies
-
Hi @eliassal , Try this, I just tested it right now by opening an issue in one of my private repos and it works: name: Learning GitHub Script
on:
issues:
types: [opened]
jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Comment on new issue
uses: actions/github-script@0.8.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "🎉 You've created this issue comment using GitHub Script!!!"
});
- name: Add issue to project board
if: contains(github.event.issue.labels.*.name, 'bug')
uses: actions/github-script@0.8.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.projects.createCard({
column_id: columnID,
content_id: context.payload.issue.id,
content_type: "Issue"
}); |
Beta Was this translation helpful? Give feedback.
-
Hi @davevad93, Workflow permissions section is already set to Read and write permissions. I tried again with new script, getting same error. Couple of questions: |
Beta Was this translation helpful? Give feedback.
-
@davevad93 I am getting the same thing, "Must have admin rights to Repository." I created the secret copied your new code , so what can be the problem as you indicate the right permissions as indicated in the doc "The token must have at least one of the following permission sets:" but it says TOKEN not SECRET |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hi, I am following the learning Automate "GitHub by using GitHub Script " at https://learn.microsoft.com/en-us/training/modules/automate-github-using-github-script/3-use-github-script.
When I create a new issue I get invalid yaml error on the statement
github-token: {% raw %}${{secrets.GITHUB_TOKEN}}{% endraw %}
as follows
Then I replaced it with
${{secrets.GITHUB_TOKEN}}
First part of works fine for commenting the issue, but declaring a new issue with label = bug I get the following error
so why those errors and how they can be fixed? Thanks
Beta Was this translation helpful? Give feedback.
All reactions