From e883854a54dd42945c3bb160a16b7e14ec6df838 Mon Sep 17 00:00:00 2001 From: VOID404 Date: Sat, 7 Sep 2024 09:58:07 +0200 Subject: [PATCH] Restructure workflows --- .github/workflows/gha-summarizer.yaml | 61 ++++++++++++++++++++------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/.github/workflows/gha-summarizer.yaml b/.github/workflows/gha-summarizer.yaml index baf0dde..b5f726b 100644 --- a/.github/workflows/gha-summarizer.yaml +++ b/.github/workflows/gha-summarizer.yaml @@ -6,14 +6,49 @@ on: paths-ignore: - "README.md" - "LICENSE" - pull_request: - branches: - - main - paths-ignore: - - "README.md" - - "LICENSE" +env: + image: ghcr.io/${{ github.repository }}/gha-summarizer jobs: + build: + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + outputs: + imageid: ${{ steps.docker_metadata.outputs.imageid }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Set up Docker metadata + id: docker_metadata + uses: docker/metadata-action@v5 + with: + images: ${{ env.image }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=sha + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + push: ${{ github.event_name != 'pull_request_target' }} + tags: ${{ steps.docker_metadata.outputs.tags }} + labels: ${{ steps.docker_metadata.outputs.labels }} + test: permissions: contents: read @@ -21,18 +56,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Render template - uses: ./ + uses: docker://ghcr.io/void404/gha-summarizer/gha-summarizer@main with: - template: example/template.md - out-file: out.md - - - name: Debug ls - if: always() - run: | - ls -la - ls -la ./gha-summarizer + args: example/template.md out.md - name: Check if the rendered file is different run: |