Skip to content

Generate CHANGELOG.md #4

Generate CHANGELOG.md

Generate CHANGELOG.md #4

Workflow file for this run

---
name: Generate CHANGELOG.md
on:
workflow_dispatch:
schedule:
- cron: "0 0 1 */1 *" # Runs on the first of every month
jobs:
update_changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Pull latest Alpine and get SHA256
run: |
docker pull alpine:latest
ALPINE_SHA=$(docker image inspect alpine:latest --format '{{index .RepoDigests 0}}' | cut -d'@' -f2)
echo "ALPINE_SHA=$ALPINE_SHA" >> $GITHUB_ENV
- name: Check versions of openssh-server, gnupg, and curl
run: |
docker run --rm alpine:latest sh -c '
apk update &&
apk add --no-cache openssh-server gnupg curl &&
apk info -v openssh-server gnupg curl' > versions.txt
cat versions.txt
OPENSSH_VER=$(grep openssh-server versions.txt | awk '{print $1}')
GNUPG_VER=$(grep gnupg versions.txt | awk '{print $1}')
CURL_VER=$(grep curl versions.txt | awk '{print $1}')
echo "OPENSSH_VER=$OPENSSH_VER" >> $GITHUB_ENV
echo "GNUPG_VER=$GNUPG_VER" >> $GITHUB_ENV
echo "CURL_VER=$CURL_VER" >> $GITHUB_ENV
- name: Update CHANGELOG.md
run: |
DATE=$(date '+%Y-%m')
echo "## $DATE" >> CHANGELOG.md
echo "----------------" >> CHANGELOG.md
echo "- Alpine SHA256: $ALPINE_SHA" >> CHANGELOG.md
echo "- openssh-server version: $OPENSSH_VER" >> CHANGELOG.md
echo "- gnupg version: $GNUPG_VER" >> CHANGELOG.md
echo "- curl version: $CURL_VER" >> CHANGELOG.md
cat CHANGELOG.md
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
branch: "feature/update-alpine-$(date '+%Y-%m')"
commit-message: "Generate CHANGELOG.md for $(date '+%Y-%m')"
title: "Generate CHANGELOG.md for $(date '+%Y-%m')"
body: |
Base image updated to Alpine SHA256: ${{ env.ALPINE_SHA }}
- openssh-server version: ${{ env.OPENSSH_VER }}
- gnupg version: ${{ env.GNUPG_VER }}
- curl version: ${{ env.CURL_VER }}
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
labels: "automated update"