Skip to content

Commit 550cd46

Browse files
authored
Merge branch 'master' into patch-1
2 parents a9b9d58 + b9fda0b commit 550cd46

13 files changed

+161
-182
lines changed

.github/workflows/docker.yml

+96-49
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,113 @@
1-
name: Docker Release
1+
name: Docker
22

33
on:
44
push:
55
tags:
6-
- '*'
7-
branches:
8-
- master
6+
- "*"
7+
workflow_dispatch:
98

10-
permissions:
11-
contents: read
9+
env:
10+
REGISTRY_IMAGE: mergeability/mergeable
1211

1312
jobs:
14-
init:
15-
permissions:
16-
contents: none
17-
runs-on: ubuntu-latest
18-
outputs:
19-
do_docker: ${{ steps.vars.outputs.IS_DOCKERHUB_PUSH }}
20-
steps:
21-
- name: Initialize workflow variables
22-
shell: bash
23-
run: |
24-
# work-around for inaccessible 'secrets' object for 'if'; see <https://github.community/t5/GitHub-Actions/jobs-lt-job-id-gt-if-does-not-work-with-env-secrets/m-p/38549>)
25-
unset IS_DOCKERHUB_PUSH
26-
if [ -z "$DOCKERHUB_PUSH" ]; then IS_DOCKERHUB_PUSH='false'; else IS_DOCKERHUB_PUSH='true' ; fi
27-
echo set-output name=IS_DOCKERHUB_PUSH::${IS_DOCKERHUB_PUSH}
28-
echo ::set-output name=IS_DOCKERHUB_PUSH::${IS_DOCKERHUB_PUSH}
29-
env:
30-
DOCKERHUB_PUSH: ${{ secrets.DOCKERHUB_PUSH }}
3113
build:
32-
name: Build and push Docker image
3314
runs-on: ubuntu-latest
34-
needs: [init]
35-
if: ${{ needs.init.outputs.do_docker == 'true' }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
platform:
19+
- linux/amd64
20+
# Failing to build
21+
# - linux/arm/v6
22+
- linux/arm/v7
23+
- linux/arm64
3624
steps:
25+
- name: Prepare
26+
run: |
27+
platform=${{ matrix.platform }}
28+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
29+
3730
- name: Checkout
38-
uses: actions/checkout@v2
39-
31+
uses: actions/checkout@v4
32+
33+
- name: Docker meta
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY_IMAGE }}
38+
4039
- name: Set up Docker Buildx
41-
uses: docker/setup-buildx-action@v1
42-
43-
- name: Login to DockerHub
44-
uses: docker/login-action@v1
40+
uses: docker/setup-buildx-action@v3
41+
42+
- name: Login to Docker Hub
43+
uses: docker/login-action@v3
4544
with:
4645
username: ${{ secrets.DOCKERHUB_USERNAME }}
47-
password: ${{ secrets.DOCKERHUB_PASSWORD }}
48-
49-
- name: Build and push latest
50-
uses: docker/build-push-action@v2
51-
if: github.ref == 'refs/heads/master'
46+
password: ${{ secrets.DOCKERHUB_TOKEN }}
47+
48+
- name: Build and push by digest
49+
id: build
50+
uses: docker/build-push-action@v5
5251
with:
53-
push: true
54-
tags: ${{ secrets.DOCKERHUB_REPO }}:latest
55-
56-
- name: Set version variable
57-
id: version
58-
if: startsWith(github.ref, 'refs/tags/')
59-
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
52+
context: .
53+
platforms: ${{ matrix.platform }}
54+
labels: ${{ steps.meta.outputs.labels }}
55+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
56+
cache-from: type=gha,scope=build-${{ matrix.platform }}
57+
cache-to: type=gha,mode=max,scope=build-${{ matrix.platform }}
58+
59+
- name: Export digest
60+
run: |
61+
mkdir -p /tmp/digests
62+
digest="${{ steps.build.outputs.digest }}"
63+
touch "/tmp/digests/${digest#sha256:}"
64+
65+
- name: Upload digest
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: digests-${{ env.PLATFORM_PAIR }}
69+
path: /tmp/digests/*
70+
if-no-files-found: error
71+
retention-days: 1
6072

61-
- name: Build and push tag
62-
uses: docker/build-push-action@v2
63-
if: startsWith(github.ref, 'refs/tags/')
73+
merge:
74+
runs-on: ubuntu-latest
75+
needs:
76+
- build
77+
steps:
78+
- name: Download digests
79+
uses: actions/download-artifact@v4
80+
with:
81+
path: /tmp/digests
82+
pattern: digests-*
83+
merge-multiple: true
84+
85+
- name: Set up Docker Buildx
86+
uses: docker/setup-buildx-action@v3
87+
88+
- name: Docker meta
89+
id: meta
90+
uses: docker/metadata-action@v5
6491
with:
65-
push: true
66-
tags: ${{ secrets.DOCKERHUB_REPO }}:${{ steps.version.outputs.TAG }}
92+
images: ${{ env.REGISTRY_IMAGE }}
93+
tags: |
94+
# minimal
95+
type=semver,pattern={{version}}
96+
# set latest tag for default branch
97+
type=raw,value=latest,enable={{is_default_branch}}
98+
99+
- name: Login to Docker Hub
100+
uses: docker/login-action@v3
101+
with:
102+
username: ${{ secrets.DOCKERHUB_USERNAME }}
103+
password: ${{ secrets.DOCKERHUB_TOKEN }}
104+
105+
- name: Create manifest list and push
106+
working-directory: /tmp/digests
107+
run: |
108+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
109+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
110+
111+
- name: Inspect image
112+
run: |
113+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Some examples of what you can do:
2525
- Ensure pull requests follow conventions and [prevent merging][comment-if-guidelines-not-met] when it is not followed.
2626
- [Notify author of failed guidelines][comment] when opening an issue.
2727
- Schedule [detection for obsolete (stale) issues and pull requests][staleness] and notify author and collaborators.
28+
- [Auto-merge][automerge] pull requests once all checks pass.
2829
- And [more][configuration]
2930

3031
---
@@ -45,7 +46,7 @@ We need your help:
4546
- Have an **💡idea** for a **new feature**? Please [create a new issue](https://github.com/mergeability/mergeable/issues) and tell us!
4647
- **Fix a bug**, implement a new **validator** or **action** and [open a pull request](CONTRIBUTING.md)!
4748

48-
> ☝️ **NOTE:** For development and testing. You'll want to [read about how to run it locally](deploy.md#running-locally).
49+
> ☝️ **NOTE:** For development and testing. You'll want to [read about how to run it locally][run-locally].
4950
5051

5152
# Authors
@@ -58,4 +59,6 @@ AGPL, Copyright (c) 2019 [Justin Law](https://github.com/jusx) & [Shine Lee](htt
5859
[comment-if-guidelines-not-met]: https://mergeable.readthedocs.io/en/latest/recipes.html#comment-if-guidelines-not-met
5960
[comment]: https://mergeable.readthedocs.io/en/latest/actions/comment.html
6061
[staleness]: https://mergeable.readthedocs.io/en/latest/recipes.html#check-stale-pr-and-issues
62+
[automerge]: https://mergeable.readthedocs.io/en/latest/recipes.html#auto-merge-pull-requests-once-all-checks-pass
6163
[configuration]: https://mergeable.readthedocs.io/en/latest/configuration.html
64+
[run-locally]: https://mergeable.readthedocs.io/en/latest/deployment.html#running-locally

deploy.md

-58
This file was deleted.

docs/annotations.rst

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
.. _annotations-page:
12
Annotations
23
=====================================
34

45
Annotations allows the use of dynamic values in your recipes.
56

6-
To bypass the annotation, use `\` prefix. (i.e `\@author` will be replaced with literal `@author`)
7+
To bypass the annotation, use ``\`` prefix. (i.e ``\@author`` will be replaced with literal `@author`)
78

89
::
10+
911
@author : replace with the login of creator of issues/PR
1012

11-
Actions supported
1213

13-
- assign
14-
- comment
15-
- checks
14+
Actions supported:
15+
::
1616

17+
'assign', 'comment', 'checks'
1718

1819

19-
.. note::
20-
Don't see any annotation that fits your needs? let us know by creating an `issue <https://github.com/mergeability/mergeable/issues/new>`_
20+
.. hint::
21+
Don't see any annotation that fits your needs? Let us know by creating an `issue <https://github.com/mergeability/mergeable/issues/new>`_ on github.
2122

2223

docs/configuration.rst

+11-9
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Configuration
77

88
First, you'll need to start by creating a ``.github/mergeable.yml`` file in your repository.
99

10-
.. hint::
11-
Check out our :ref:`recipes-page` page for examples and most commonly used settings
10+
.. note::
11+
Check out our :ref:`recipes-page` page for examples and most commonly used settings.
1212

1313
Next, we'll go into how the configuration is structured.
1414

@@ -34,7 +34,7 @@ error:
3434

3535
Each recipe appears as a separate check in the pull request.
3636

37-
Here is a full example of how a recipe looks -
37+
Here is a full example of how a recipe looks:
3838

3939
.. code-block:: yml
4040
@@ -79,7 +79,7 @@ Here is a full example of how a recipe looks -
7979
- do: {{action}}
8080
8181
.. note::
82-
There are some default actions that'll be automatically applied based on the events specified
82+
There are some default actions that'll be automatically applied based on the events specified.
8383

8484
Filters
8585
------------
@@ -90,7 +90,7 @@ Filters are checks that mergeable will process in order to determine if validato
9090
Each filter have certain events that it can support, so keep an eye out for them.
9191

9292
.. hint::
93-
Don't see an filter that should be on here? Let us know by creating an `issue <https://github.com/mergeability/mergeable/issues/new>`_ on github
93+
Don't see an filter that should be on here? Let us know by creating an `issue <https://github.com/mergeability/mergeable/issues/new>`_ on github.
9494

9595
Filter List
9696

@@ -108,7 +108,7 @@ Validators are checks that mergeable will process in order to determine whether
108108
Each validator have certain events that it can support, so keep an eye out for them.
109109

110110
.. hint::
111-
Don't see an validator that should be on here? Let us know by creating an `issue <https://github.com/mergeability/mergeable/issues/new>`_ on github
111+
Don't see an validator that should be on here? Let us know by creating an `issue <https://github.com/mergeability/mergeable/issues/new>`_ on github.
112112

113113
Validator List
114114

@@ -125,6 +125,7 @@ Validator List
125125
validators/description.rst
126126
validators/headRef.rst
127127
validators/label.rst
128+
validators/lastComment.rst
128129
validators/milestone.rst
129130
validators/project.rst
130131
validators/size.rst
@@ -153,7 +154,7 @@ Options List
153154
Operators
154155
------------
155156

156-
These operators can help create more complex logic of validations
157+
These operators can help create more complex logic of validations.
157158

158159
Operator List
159160

@@ -169,7 +170,7 @@ Actions
169170
Actions that mergeable is currently able to perform.
170171

171172
.. hint::
172-
Don't see an action that should be on here? Let us know by creating an `issue <https://github.com/mergeability/mergeable/issues/new>`_ on github
173+
Don't see an action that should be on here? Let us know by creating an `issue <https://github.com/mergeability/mergeable/issues/new>`_ on github.
173174

174175
.. toctree::
175176
actions/assign.rst
@@ -185,9 +186,10 @@ Actions that mergeable is currently able to perform.
185186
Reusable Configuration
186187
--------------------------
187188

188-
YML has a feature called `Anchor<https://blog.daemonl.com/2016/02/yaml.html>`_ that allows you to create reusable parts in the config
189+
YML has a feature called `Anchor <https://blog.daemonl.com/2016/02/yaml.html>`_ that allows you to create reusable parts in the config:
189190

190191
.. code-block:: yml
192+
191193
on_fail_comment: &default_fail_comment
192194
- do: comment
193195
payload:

0 commit comments

Comments
 (0)