-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1652 from GoogleContainerTools/add-java-update-ac…
…tion Add temurin archive updater action
- Loading branch information
Showing
1 changed file
with
53 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,53 @@ | ||
name: update-snapshots | ||
on: | ||
# will send emails to last editor of this cron syntax (distroless-bot) | ||
schedule: | ||
- cron: "35 20 * * *" | ||
# allow this workflow to be manually run | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Update snapshots | ||
run: ./knife update-java-archives | ||
|
||
- name: Create commits | ||
if: env.DISTROLESS_DIFF | ||
id: create-commits | ||
run: | | ||
git checkout -b update-java-archives | ||
# Set identity. | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Distroless Bot" | ||
# Commit changes | ||
git add . | ||
git commit -s -m "Bumping temurin archives to latest stable versions" | ||
git push --force origin HEAD | ||
- name: Create Pull Request | ||
env: | ||
GH_TOKEN: ${{ secrets.ACTIONS_TOKEN }} | ||
run: | | ||
BODY_FILE=$(mktemp) | ||
if ! OUTPUT=$(gh pr create -B main -H update-snapshots -t "Bumping temurin archives to latest stable versions" 2>&1) ; then | ||
echo $OUTPUT | ||
if [[ "${OUTPUT}" =~ "already exists" ]]; then | ||
echo "PR already exists and it was updated. Ending successfully"; | ||
exit 0; | ||
else | ||
exit 1; | ||
fi | ||
fi |