Update Mojaloop image tags (push) - #12
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
name: Update Mojaloop image tags | |
run-name: Update Mojaloop image tags (${{ github.event.inputs.tag || github.event_name }}) - ${{ github.event.inputs.image }} | |
on: | |
workflow_dispatch: | |
inputs: | |
image: | |
description: Published image | |
default: '*' | |
tag: | |
description: Updated tag | |
upstream: | |
description: Upstream job URL | |
push: | |
branches: | |
- main | |
paths: | |
- updatecli.d/* | |
schedule: | |
- cron: '0 0 * * *' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
updatecli: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install updatecli | |
uses: updatecli/updatecli-action@v2 | |
- name: Update image tags | |
run: | | |
echo "Updating Mojaloop image tags:" > update.log | |
echo "${{ github.event.inputs.upstream }}" > update.log | |
updatecli apply |& tee /dev/tty | grep -o '[^.]*\.image\.tag" updated from .*,' | sed -e 's/[",]//g;s/^/- /' >> update.log | |
- name: Create pull request | |
id: create_pr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: Update Mojaloop image tags (${{ github.event.inputs.tag || github.event_name }}) - ${{ github.event.inputs.image }} | |
title: Update Mojaloop image tags (${{ github.event.inputs.tag || github.event_name }}) - ${{ github.event.inputs.image }} | |
body-path: update.log | |
- name: Auto merge pull request | |
if: steps.create_pr.outputs.pull-request-number && github.event_name != 'push' | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }} | |
merge-method: squash | |
token: ${{ secrets.MERGE_TOKEN }} |