Push and comment PR build #2
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: Push and comment PR build | |
on: | |
workflow_run: | |
workflows: | |
- "Build Images for PRs" | |
types: | |
- completed | |
jobs: | |
push: | |
runs-on: ubuntu-latest | |
if: > | |
github.event.workflow_run.conclusion == 'success' | |
steps: | |
- name: Load artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: oci-image | |
path: /oci-image.tar | |
- name: Login to Docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Load image | |
run: | | |
docker load --input /oci-image.tar | |
docker image ls -a | |
- name: Docker push image | |
run: | | |
docker push hobbyfarm/hf-provisioner-digitalocean:${{ github.event.pull_request.head.sha }} | |
- name: Comment | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.DEMETER_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'An image has been built, my little sprouts. Find it here: hobbyfarm/hf-provisioner-digitalocean:${{ github.event.pull_request.head.sha }}' | |
}) |