Check for updates to base image #6
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: Check for updates to base image | |
on: workflow_dispatch | |
jobs: | |
check-for-update: | |
runs-on: ubuntu-latest | |
outputs: | |
needs-updating: ${{ steps.check-alpine-socat.outputs.needs-updating }} | |
steps: | |
- name: Get latest release of this repo | |
id: get-latest-release | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
owner: 11matt556 | |
repo: socat-cron | |
excludes: prerelease, draft | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check if update available in alpine/socat | |
id: check-alpine-socat | |
uses: lucacome/docker-image-update-checker@v1 | |
with: | |
base-image: alpine/socat | |
image: 11matt556/socat-cron:latest | |
# Check if issue has already been created | |
check-for-reminder-issue: | |
if: needs.check-for-update.outputs.needs-updating == 'true' | |
needs: check-for-update | |
runs-on: ubuntu-latest | |
outputs: | |
issue-exists: ${{ steps.check-if-issue-exists.outputs.exists }} | |
steps: | |
- name: Search for existing issue | |
id: matching-issues | |
uses: lee-dohm/select-matching-issues@v1 | |
with: | |
query: 'Updated alpine/socat available is:open' | |
token: ${{ github.token }} | |
- name: Check if issue already exists | |
id: check-if-issue-exists | |
shell: bash | |
run: | | |
matching_issues = $(cat ${{ steps.matching-issues.outputs.path }}) | |
if [ $matching_issues != '' ]; then | |
echo "exists=true" >> $GITHUB_OUTPUT; | |
else | |
echo "exists=false" >> $GITHUB_OUTPUT; | |
fi | |
# Create reminder issue if it doesn't already exist | |
create-issue: | |
if: needs.check-for-reminder-issue.outputs.issue-exists == 'false' | |
needs: check-for-reminder-issue | |
runs-on: ubuntu-latest | |
steps: | |
# Create issue stating update is available if issue has not already been created | |
- name: create an issue | |
uses: dacbd/create-issue-action@main | |
with: | |
token: ${{ github.token }} | |
title: Updated alpine/socat available | |
body: | | |
Updated alpine/socat base is available. Consider updating. | |
\ | |
https://hub.docker.com/r/alpine/socat | |
# TODO: List available tags from base image in the issue | |