Skip to content

Commit e883854

Browse files
committed
Restructure workflows
1 parent 2cf3e44 commit e883854

File tree

1 file changed

+46
-15
lines changed

1 file changed

+46
-15
lines changed

.github/workflows/gha-summarizer.yaml

+46-15
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,64 @@ on:
66
paths-ignore:
77
- "README.md"
88
- "LICENSE"
9-
pull_request:
10-
branches:
11-
- main
12-
paths-ignore:
13-
- "README.md"
14-
- "LICENSE"
9+
env:
10+
image: ghcr.io/${{ github.repository }}/gha-summarizer
1511

1612
jobs:
13+
build:
14+
permissions:
15+
contents: read
16+
packages: write
17+
runs-on: ubuntu-latest
18+
outputs:
19+
imageid: ${{ steps.docker_metadata.outputs.imageid }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.event.pull_request.head.ref }}
25+
repository: ${{ github.event.pull_request.head.repo.full_name }}
26+
27+
- name: Set up Docker metadata
28+
id: docker_metadata
29+
uses: docker/metadata-action@v5
30+
with:
31+
images: ${{ env.image }}
32+
tags: |
33+
type=ref,event=branch
34+
type=ref,event=pr
35+
type=ref,event=tag
36+
type=sha
37+
38+
- name: Login to GitHub Container Registry
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Build and push Docker image
46+
uses: docker/build-push-action@v6
47+
with:
48+
push: ${{ github.event_name != 'pull_request_target' }}
49+
tags: ${{ steps.docker_metadata.outputs.tags }}
50+
labels: ${{ steps.docker_metadata.outputs.labels }}
51+
1752
test:
1853
permissions:
1954
contents: read
2055
runs-on: ubuntu-latest
2156
steps:
2257
- name: Checkout
2358
uses: actions/checkout@v4
59+
with:
60+
ref: ${{ github.event.pull_request.head.ref }}
61+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2462

2563
- name: Render template
26-
uses: ./
64+
uses: docker://ghcr.io/void404/gha-summarizer/gha-summarizer@main
2765
with:
28-
template: example/template.md
29-
out-file: out.md
30-
31-
- name: Debug ls
32-
if: always()
33-
run: |
34-
ls -la
35-
ls -la ./gha-summarizer
66+
args: example/template.md out.md
3667

3768
- name: Check if the rendered file is different
3869
run: |

0 commit comments

Comments
 (0)