-
Notifications
You must be signed in to change notification settings - Fork 48
46 lines (41 loc) · 1.6 KB
/
automerge-transifex-app-prs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Automatically merge pull requests created by the "Transifex Integration" github app
# https://github.com/apps/transifex-integration
name: Automerge Transifex GH app PRs
on:
- pull_request
jobs:
automerge-transifex-app-pr:
runs-on: ubuntu-latest
# Merges the pull request
steps:
- name: clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: merge pull request
uses: nick-fields/retry@v2
id: mergePR
env:
# secrets can't be used in job conditionals, so we set them to env here
TRANSIFEX_APP_ACTOR_NAME: "${{ secrets.TRANSIFEX_APP_ACTOR_NAME }}"
TRANSIFEX_APP_ACTOR_ID: "${{ secrets.TRANSIFEX_APP_ACTOR_ID }}"
# This token requires Write access to the openedx-translations repo
GITHUB_TOKEN: ${{ secrets.EDX_TRANSIFEX_BOT_GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
if: "${{ github.actor == env.TRANSIFEX_APP_ACTOR_NAME && github.actor_id == env.TRANSIFEX_APP_ACTOR_ID }}"
with:
retry_wait_seconds: 180
max_attempts: 5
timeout_minutes: 15
retry_on: error
command: |
# Attempt to merge the PR
gh pr merge ${{ github.head_ref }} --rebase --auto
MERGE_DATE="$(gh pr view "$PR_NUMBER" --json mergedAt --jq '.mergedAt')"
if [ -n "$MERGE_DATE" ]; then
echo "Success: PR merged at '$MERGE_DATE'"
exit 0
else
echo "PR not merged yet, retrying via 'nick-fields/retry'..."
exit 1
fi