Create pull request for docker dependency package if outdated
Assuming a docker file like this...

FROM ubuntu:18.04

ARG TF_VERSION=0.12.25

RUN apt-get install wget -y

RUN wget -O terraform.zip https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip


In your GitHub action you would need to get the current version from your Dockerfile.

export CURRENT_TF_VERSION=$(grep -Eo '[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*' Dockerfile)


Then the latest version of terraform.

export LATEST_TF_VERSION=$(curl -s 'https://checkpoint-api.hashicorp.com/v1/check/terraform' | jq -r .current_version)


Now in bash or using if and outputs in GitHub actions compare the two values. If they are not the same then find and replace the current version with the latest version in your Dockerfile.

sed -i "s/${CURRENT_TF_VERSION}/${LATEST_TF_VERSION}/" Dockerfile 


Then you can use the create-pull-request GitHub action to create a pull request.

The create-pull-request documentation doesn't mention what happens if you don't have any changes but I asked here. If it doesn't throw an error when you don't have changes then you could simply get the latest value and run sed.

sed "s/[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*/${LATEST_TF_VERSION}/" Dockerfile