Skip to content

Commit 6919ddb

Browse files
committed
Improve CI workflow
1 parent 29534b9 commit 6919ddb

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,27 +110,47 @@ jobs:
110110
name: Docker Build Check
111111
runs-on: ubuntu-latest
112112

113-
needs: Hadolint
113+
needs: [Hadolint, Perfecto, Aligo]
114114

115115
steps:
116+
- name: Check event type
117+
run: |
118+
if [[ "${{github.event_name}}" != "pull_request" ]] ; then
119+
echo "::notice::Event type is not 'pull_request', all job actions will be skipped"
120+
fi
121+
122+
# This step is a hack for needs+if issue with actions
123+
# More info about issue: https://github.com/actions/runner/issues/491
124+
116125
- name: Checkout
117126
uses: actions/checkout@v3
127+
if: ${{ github.event_name == 'pull_request' }}
118128

119129
- name: Login to DockerHub
120130
uses: docker/login-action@v2
121131
env:
122132
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
123-
if: ${{ env.DOCKERHUB_USERNAME != '' }}
133+
if: ${{ github.event_name == 'pull_request' && env.DOCKERHUB_USERNAME != '' }}
124134
with:
125135
username: ${{ secrets.DOCKERHUB_USERNAME }}
126136
password: ${{ secrets.DOCKERHUB_TOKEN }}
127137

138+
- name: Login to GitHub Container Registry
139+
uses: docker/login-action@v2
140+
if: ${{ github.event_name == 'pull_request' }}
141+
with:
142+
registry: ghcr.io
143+
username: ${{ github.actor }}
144+
password: ${{ secrets.GITHUB_TOKEN }}
145+
128146
- name: Build Docker image
147+
if: ${{ github.event_name == 'pull_request' }}
129148
run: |
130149
docker build -f Dockerfile -t sslcli .
131150
132151
- name: Show info about built Docker image
133152
uses: essentialkaos/docker-info-action@v1
153+
if: ${{ github.event_name == 'pull_request' }}
134154
with:
135155
image: sslcli
136156
show-labels: true

0 commit comments

Comments
 (0)