Skip to content

Create pull request in docker-library/official-images repo #46

Create pull request in docker-library/official-images repo

Create pull request in docker-library/official-images repo #46

name: Create pull request in docker-library/official-images repo
on:
workflow_run:
workflows: ["CI"]
types: ["completed"]
branches: ["master"]
jobs:
generate-docker-manifest:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Install babashka
uses: DeLaGuardo/[email protected]
with:
bb: 1.3.190
- name: Checkout code
uses: actions/checkout@v4
- name: Generate manifest
run: bb run manifest target/docker.manifest
- name: Upload manifest artifact
uses: actions/upload-artifact@v4
with:
name: manifest
path: target/docker.manifest
retention-days: 1
compare-manifests:
runs-on: ubuntu-latest
needs: [generate-docker-manifest]
outputs:
diff: ${{ steps.manifest-diff.outputs.diff }}
steps:
- name: Checkout docker-library/official-images repo
uses: actions/checkout@v4
with:
repository: docker-library/official-images
path: official-images
- name: Download manifest artifact
uses: actions/download-artifact@v4
with:
name: manifest
- name: Compare manifest files
id: manifest-diff
# -IGitCommit: makes it ignore changes in the GitCommit: line b/c that will always be different
run: 'echo "diff=\"$(diff -q -IGitCommit: docker.manifest official-images/library/clojure)\"" >> $GITHUB_OUTPUT'
open-official-images-pr:
runs-on: ubuntu-latest
needs: [compare-manifests]
if: contains(needs.compare-manifests.outputs.diff, 'differ')
steps:
- name: Download manifest artifact
uses: actions/download-artifact@v4
with:
name: manifest
- name: Checkout docker-library/official-images repo
uses: actions/checkout@v4
with:
repository: docker-library/official-images
path: official-images
- name: Copy manifest into official-images library
run: cp docker.manifest official-images/library/clojure
- name: Get user email
id: email
uses: evvanErb/[email protected]
with:
github-username: ${{ github.actor }}
token: ${{ secrets.API_TOKEN_GITHUB }}
- name: Open official-images pull request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.API_TOKEN_GITHUB }}
path: official-images
commit-message: 'Update clojure'
committer: GitHub Actions <[email protected]>
author: ${{ github.actor }} <${{ steps.email.outputs.email }}>
branch: automated-clojure-update
push-to-fork: Quantisan/official-images
title: Update clojure
body: |
Automated pull request to update `library/clojure` generated by
GitHub Actions on the Quantisan/docker-clojure repo.