Reputation: 407
According to GitHub Docs, one can use GitHub CLI commands in a workflow.
I am trying to programmatically update the description of the repository from a workflow in that repository, and the only solution I found was using the GitHub CLI:
name: update repo
on: push
jobs:
update:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: 'Checkout repository'
uses: actions/checkout@v3
- name: 'Update repository description'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh repo edit --description "test"
but even with permissions: write-all
, I still get the error:
HTTP 403: Resource not accessible by integration
Upvotes: 3
Views: 2210
Reputation: 1033
According to the docs you need to set GH_TOKEN
not GITHUB_TOKEN
For example:
name: Comment when opened
on:
issues:
types:
- opened
jobs:
comment:
runs-on: ubuntu-latest
steps:
- run: gh issue comment $ISSUE --body "Thank you for opening this issue!"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.html_url }}
https://docs.github.com/en/actions/using-workflows/using-github-cli-in-workflows
Upvotes: 1