Skip to content

Commit

Permalink
chore(updatecli) use temporary token from GitHub App to allow editing…
Browse files Browse the repository at this point in the history
…/starting workflows

Signed-off-by: Damien Duportal <[email protected]>
  • Loading branch information
dduportal committed Jan 15, 2022
1 parent eba5da3 commit 98ebbdb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/updatecli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,27 @@ jobs:
command: diff
flags: "--config ./updatecli/updatecli.d --values ./updatecli/values.yaml"
env:
## Use GITHUB_TOKEN for diff as any external contributor will have one allowed to read GitHub API
UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_NAME: ${{steps.get-repo-infos.outputs.repo}}
REPO_OWNER: ${{steps.get-repo-infos.outputs.owner}}
## Open PRs to upgrade dependencies using updatecli
## When on principal branch, generate a temporary token to allow starting/modifying workflows
# Not using a PAT to avoid depending on a GitHub account
- uses: tibdex/[email protected]
id: generate_token
if: github.ref == 'refs/heads/main'
with:
app_id: ${{ secrets.UPDATECLIBOT_APP_ID }}
private_key: ${{ secrets.UPDATECLIBOT_APP_PRIVKEY }}
- name: Apply
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
if: github.ref == 'refs/heads/main'
uses: updatecli/[email protected]
with:
command: apply
flags: "--config ./updatecli/updatecli.d --values ./updatecli/values.yaml"
env:
UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## Use generated token to allow writes on the GitHub API / starting fresh PRs workflows
UPDATECLI_GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
REPO_NAME: ${{steps.get-repo-infos.outputs.repo}}
REPO_OWNER: ${{steps.get-repo-infos.outputs.owner}}
...

0 comments on commit 98ebbdb

Please sign in to comment.