Skip to content

Commit

Permalink
perf: simplify renovate job (#225)
Browse files Browse the repository at this point in the history
Signed-off-by: msclock <msclock@qq.com>
  • Loading branch information
msclock committed Apr 23, 2024
1 parent 0336f27 commit 112d661
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,26 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: env | sort
- id: generate-token
name: Generate a token with GitHub App if App ID exists

- name: Generate a token with GitHub App if App ID exists
id: generate-token
if: vars.BOT_APP_ID
uses: actions/create-github-app-token@7bfa3a4717ef143a604ee0a99d859b8886a96d00 # v1
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}

- name: Warn if RENOVATE_GIT_AUTHOR is set while using GitHub App token
if: steps.generate-token.outputs.token && vars.RENOVATE_GIT_AUTHOR
run: |
echo "# :warning: `RENOVATE_GIT_AUTHOR` is set explicitly while using GitHub App token" >> $GITHUB_STEP_SUMMARY
echo "Generally, Renovate automatically detects the git author and email using the token. However, explicitly setting the `RENOVATE_GIT_AUTHOR` will override this behavior." >> $GITHUB_STEP_SUMMARY
- name: Run Renovate
env:
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 }}" ] && [ -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
echo "RENOVATE_TOKEN is not properly configured, skipping ..."
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,26 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: env | sort
- id: generate-token
name: Generate a token with GitHub App if App ID exists

- name: Generate a token with GitHub App if App ID exists
id: generate-token
if: vars.BOT_APP_ID
uses: actions/create-github-app-token@7bfa3a4717ef143a604ee0a99d859b8886a96d00 # v1
with:
app-id: {{ '${{ vars.BOT_APP_ID }}' }}
private-key: {{ '${{ secrets.BOT_PRIVATE_KEY }}' }}

- name: Warn if RENOVATE_GIT_AUTHOR is set while using GitHub App token
if: steps.generate-token.outputs.token && vars.RENOVATE_GIT_AUTHOR
run: |
echo "# :warning: `RENOVATE_GIT_AUTHOR` is set explicitly while using GitHub App token" >> $GITHUB_STEP_SUMMARY
echo "Generally, Renovate automatically detects the git author and email using the token. However, explicitly setting the `RENOVATE_GIT_AUTHOR` will override this behavior." >> $GITHUB_STEP_SUMMARY

- name: Run Renovate
env:
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 }}' }}" ] && [ -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
echo "RENOVATE_TOKEN is not properly configured, skipping ..."
else
Expand Down

0 comments on commit 112d661

Please sign in to comment.