File tree Expand file tree Collapse file tree 3 files changed +29
-31
lines changed Expand file tree Collapse file tree 3 files changed +29
-31
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,6 @@ name: Build test harness image
3
3
on :
4
4
workflow_call :
5
5
inputs :
6
- image-name :
7
- type : string
8
- required : true
9
- description : ' Name for the image to build'
10
6
publish-image :
11
7
type : boolean
12
8
default : false
@@ -46,14 +42,20 @@ jobs:
46
42
- name : Install bowtie
47
43
uses : bowtie-json-schema/bowtie@main
48
44
45
+ - name : Compute implementation name
46
+ id : impl
47
+ env :
48
+ GH_REPOSITORY : ${{ github.repository }}
49
+ run : echo "name=$(echo ${GH_REPOSITORY} | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT
50
+
49
51
- name : Build
50
52
id : build_image
51
53
uses : redhat-actions/buildah-build@v2
52
54
with :
53
55
context : ' .'
54
56
containerfiles : |
55
57
Dockerfile
56
- image : ${{ inputs.image- name }}
58
+ image : ${{ steps.impl.outputs. name }}
57
59
tags : ${{ github.sha }} ${{ inputs.is-latest && 'latest' || '' }}
58
60
archs : amd64, arm64
59
61
Original file line number Diff line number Diff line change 21
21
runs-on : ubuntu-latest
22
22
outputs :
23
23
latest-version : ${{ steps.version.outputs.value }}
24
- implementation-name : ${{ steps.impl.outputs.name }}
25
24
steps :
26
25
27
26
- name : Install bowtie
55
54
56
55
uses : ./.github/workflows/build-image.yml
57
56
with :
58
- image-name : ${{ needs.meta.outputs.implementation-name }}
59
57
is-latest : ${{ github.ref == 'refs/heads/main' }}
60
58
publish-image : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
61
59
@@ -113,21 +111,3 @@ jobs:
113
111
env :
114
112
PR_URL : ${{ github.event.pull_request.html_url }}
115
113
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
116
-
117
- # Job is required to automatically publish an image for successfully merged dependabot's PR.
118
- # PR is merged with GITHUB_TOKEN and it does not trigger the workflow run on 'push'.
119
- # Executes only if 'automerge' is not skipped
120
- publish-on-automerge :
121
- needs : [meta, automerge]
122
-
123
- permissions :
124
- id-token : write
125
- contents : read
126
- attestations : write
127
- packages : write
128
-
129
- uses : ./.github/workflows/build-image.yml
130
- with :
131
- image-name : ${{ needs.meta.outputs.implementation-name }}
132
- is-latest : ${{ github.event.pull_request.base.ref == 'main' }}
133
- publish-image : true
Original file line number Diff line number Diff line change 4
4
workflow_run : # zizmor: ignore[dangerous-triggers] we are aware that it is a dengerouse trigger but we need a way to build an image after Dependabot PR
5
5
types : [ completed ]
6
6
workflows : [ 'Rebuild Bowtie Image' ]
7
+ branches :
8
+ - ' dependabot/**'
7
9
8
10
permissions : {}
9
11
12
+ concurrency :
13
+ # in this case if several dependabot PRs are merged only the latest one will build and publish the image
14
+ group : dependabot-${{ github.event.workflow_run.event }}-${{ github.event.workflow_run.triggering_actor.login }}
15
+ cancel-in-progress : true
16
+
10
17
jobs :
11
18
build-and-publish :
12
- runs-on : ubuntu-latest
13
- steps :
14
- - name : Print trigger event
15
- env :
16
- EVENT_PAYLOAD : ${{ toJson(github.event) }}
17
- run : echo $EVENT_PAYLOAD
19
+ if : |
20
+ github.event.workflow_run.event == 'pull_request'
21
+ && github.event.workflow_run.conclusion == 'success'
22
+ && github.event.workflow_run.triggering_actor.login == 'dependabot[bot]'
23
+
24
+ permissions :
25
+ id-token : write
26
+ contents : read
27
+ attestations : write
28
+ packages : write
29
+
30
+ uses : ./.github/workflows/build-image.yml
31
+ with :
32
+ is-latest : true
33
+ publish-image : true
You can’t perform that action at this time.
0 commit comments