|
| 1 | +name: Update Docker Args |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + - cron: 0 1 * * 1 |
| 5 | + workflow_dispatch: |
| 6 | +jobs: |
| 7 | + update-docker-args: |
| 8 | + runs-on: ubuntu-22.04 |
| 9 | + permissions: |
| 10 | + contents: write |
| 11 | + pull-requests: write |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Update Docker Args |
| 17 | + shell: bash |
| 18 | + id: args |
| 19 | + run: | |
| 20 | + BASE_IMAGE="gcr.io/distroless/cc-debian12" |
| 21 | + BASE_IMAGE_TAG="debug" |
| 22 | + BASE_IMAGE_DIGEST=$(gcloud container images list-tags $BASE_IMAGE --format json | jq --arg tag "$BASE_IMAGE_TAG" -r '.[] | {digest: .digest, tag: .tags[]} | select(.tag == $tag) | .digest') |
| 23 | + if [ -n "$BASE_IMAGE_DIGEST" ]; then |
| 24 | + echo -n "${BASE_IMAGE}:${BASE_IMAGE_TAG}@${BASE_IMAGE_DIGEST}" > java-11/base.image |
| 25 | + echo -n "${BASE_IMAGE}:${BASE_IMAGE_TAG}@${BASE_IMAGE_DIGEST}" > java-21/base.image |
| 26 | + echo "digest=${BASE_IMAGE_DIGEST}" >> $GITHUB_OUTPUT |
| 27 | + else |
| 28 | + echo "digest=null" >> $GITHUB_OUTPUT |
| 29 | + fi |
| 30 | +
|
| 31 | + - name: Create Pull Request |
| 32 | + if: steps.args.outputs.digest != 'null' |
| 33 | + uses: peter-evans/create-pull-request@v6 |
| 34 | + id: create-pull-request |
| 35 | + with: |
| 36 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + title: Update docker args (Automated) |
| 38 | + body: | |
| 39 | + # Autogenerated docker args update: |
| 40 | + digest: ${{ steps.args.outputs.digest }} |
| 41 | + commit-message: Update docker args |
| 42 | + delete-branch: true |
| 43 | + branch-suffix: timestamp |
| 44 | + |
| 45 | + - name: Enable Pull Request Automerge |
| 46 | + if: steps.args.outputs.digest != 'null' |
| 47 | + uses: peter-evans/enable-pull-request-automerge@v3 |
| 48 | + with: |
| 49 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }} |
| 51 | + merge-method: squash |
| 52 | + |
| 53 | + # - name: Approve Pull Request |
| 54 | + # if: steps.args.outputs.digest != 'null' |
| 55 | + # uses: juliangruber/approve-pull-request-action@v2 |
| 56 | + # with: |
| 57 | + # github-token: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + # number: ${{ steps.create-pull-request.outputs.pull-request-number }} |
0 commit comments