-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action to auto update gradle wrapper (#5511)
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# this is useful because notifications for scheduled workflows are only sent to the user who | ||
# initially created the given workflow | ||
name: Reusable - Workflow notification | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
success: | ||
type: boolean | ||
required: true | ||
|
||
jobs: | ||
workflow-notification: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Open issue or add comment if issue already open | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
number=$(gh issue list --search "Workflow failed: $GITHUB_WORKFLOW" --limit 1 --json number -q .[].number) | ||
if [[ $number ]]; then | ||
if [[ "${{ inputs.success }}" == "true" ]]; then | ||
gh issue close $number | ||
else | ||
gh issue comment $number \ | ||
--body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)." | ||
fi | ||
elif [[ "${{ inputs.success }}" == "false" ]]; then | ||
gh issue create --title "Workflow failed: $GITHUB_WORKFLOW (#$GITHUB_RUN_NUMBER)" \ | ||
--body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Update gradle wrappers (daily) | ||
|
||
on: | ||
schedule: | ||
# daily at 1:30 UTC | ||
- cron: "30 1 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-gradle-wrapper: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- id: setup-java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
|
||
- name: Update Gradle Wrapper | ||
uses: gradle-update/update-gradle-wrapper-action@v1 | ||
|
||
workflow-notification: | ||
needs: | ||
- update-gradle-wrapper | ||
if: always() | ||
uses: ./.github/workflows/reusable-workflow-notification.yml | ||
with: | ||
success: ${{ needs.update-gradle-wrapper.result == 'success' }} |