Skip to content

Commit

Permalink
perf: warn the usage of RENOVATE_GIT_AUTHOR (#217)
Browse files Browse the repository at this point in the history
Signed-off-by: msclock <msclock@qq.com>
  • Loading branch information
msclock committed Apr 19, 2024
1 parent 0de5004 commit 69e5a64
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Run Renovate
env:
RENOVATE_TOKEN: ${{ steps.generate-token.outputs.token || secrets.RENOVATE_TOKEN }}
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN || steps.generate-token.outputs.token }}
RENOVATE_GIT_AUTHOR: ${{ vars.RENOVATE_GIT_AUTHOR }}
run: |
if [ -n "${{ steps.generate-token.outputs.token }}" ]; then
unset RENOVATE_GIT_AUTHOR
export RENOVATE_USERNAME="${{ steps.generate-token.outputs.app-slug }}[bot]"
if [ -n "${{ steps.generate-token.outputs.token }}" ] && [ -n "$RENOVATE_GIT_AUTHOR" ]; then
echo "# :warning: RENOVATE_GIT_AUTHOR is set when using GitHub App token" >> $GITHUB_STEP_SUMMARY
echo "Normally, RENOVATE_GIT_AUTHOR will be resolved from the token by Renovate. However, if you set RENOVATE_GIT_AUTHOR, it will override the token's git author." >> $GITHUB_STEP_SUMMARY
fi
if [ -z "$RENOVATE_TOKEN" ]; then
Expand Down
7 changes: 5 additions & 2 deletions docs/topics/automate_dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ For open-source repositories or organizations, a bot account is recommended to a

It can simply reuse the existing configuration of the release workflow . See the [release workflow configuration](./release_workflow.md) section.

- Apply the same bot configured variables and secrets:
- Option 1: Apply the same bot configured variables and secrets:
- BOT_APP_ID
- BOT_PRIVATE_KEY
- Apply the same PAT.
- Option 2: Apply the same PAT to set as the renovat token `RENOVATE_TOKEN`.

```{note}
Normally, the author of prs created by Renovate will be assigned automatically to the bot account if it is configured with Option 1 or the account of the PAT if it is configured with Option 2. But it may be customized to assign the author by `RENOVATE_GIT_AUTHOR` variable. And its format should be `username <useremail>`.
```

## Customize dependencies detection

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ For open-source repositories or organizations, a bot account is recommended to a

It can simply reuse the existing configuration of the release workflow . See the [release workflow configuration](./release_workflow.md) section.

- Apply the same bot configured variables and secrets:
- Option 1: Apply the same bot configured variables and secrets:
- BOT_APP_ID
- BOT_PRIVATE_KEY
- Apply the same PAT.
- Option 2: Apply the same PAT to set as the renovat token `RENOVATE_TOKEN`.

```{note}
Normally, the author of prs created by Renovate will be assigned automatically to the bot account if it is configured with Option 1 or the account of the PAT if it is configured with Option 2. But it may be customized to assign the author by `RENOVATE_GIT_AUTHOR` variable. And its format should be `username <useremail>`.
```

## Customize dependencies detection

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
private-key: {{ '${{ secrets.BOT_PRIVATE_KEY }}' }}
- name: Run Renovate
env:
RENOVATE_TOKEN: {{ '${{ steps.generate-token.outputs.token || secrets.RENOVATE_TOKEN }}' }}
RENOVATE_TOKEN: {{ '${{ secrets.RENOVATE_TOKEN || steps.generate-token.outputs.token }}' }}
RENOVATE_GIT_AUTHOR: {{ '${{ vars.RENOVATE_GIT_AUTHOR }}' }}
run: |
if [ -n "{{ '${{ steps.generate-token.outputs.token }}' }}" ]; then
unset RENOVATE_GIT_AUTHOR
export RENOVATE_USERNAME="{{ '${{ steps.generate-token.outputs.app-slug }}' }}[bot]"
if [ -n "{{ '${{ steps.generate-token.outputs.token }}' }}" ] && [ -n "$RENOVATE_GIT_AUTHOR" ]; then
echo "# :warning: RENOVATE_GIT_AUTHOR is set when using GitHub App token" >> $GITHUB_STEP_SUMMARY
echo "Normally, RENOVATE_GIT_AUTHOR will be resolved from the token by Renovate. However, if you set RENOVATE_GIT_AUTHOR, it will override the token's git author." >> $GITHUB_STEP_SUMMARY
fi

if [ -z "$RENOVATE_TOKEN" ]; then
Expand Down

0 comments on commit 69e5a64

Please sign in to comment.