1
+ name : Deriv App Remote Config backup file
2
+
3
+ permissions :
4
+ actions : write
5
+ checks : write
6
+ contents : write
7
+ deployments : write
8
+ pull-requests : write
9
+ statuses : write
10
+ on :
11
+ push :
12
+ branches :
13
+ - master
14
+
15
+ jobs :
16
+ download_remote_config_backup_and_create_pr :
17
+ name : Download Remote Config Backup File and Create PR
18
+ runs-on : ubuntu-latest
19
+ environment : Staging
20
+ env :
21
+ REMOTE_CONFIG_BRANCH : " remote_config_update_branch"
22
+ steps :
23
+ - name : Checkout
24
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
25
+ - name : Import GPG key
26
+ id : import-gpg
27
+ uses : deriv-com/ghaction-import-gpg@v6
28
+ with :
29
+ gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
30
+ passphrase : ${{ secrets.GPG_PASSPHRASE }}
31
+ git_user_signingkey : true
32
+ git_commit_gpgsign : true
33
+ - name : Checkout to remote_config_update_branch
34
+ run : |
35
+ git fetch origin
36
+ git checkout "$REMOTE_CONFIG_BRANCH" || git checkout -b "$REMOTE_CONFIG_BRANCH" origin/"$REMOTE_CONFIG_BRANCH"
37
+ shell : bash
38
+ - name : Download Remote Config Backup File
39
+ uses : .github/actions/download_remote_config_backup
40
+ with :
41
+ REMOTE_CONFIG_URL : ${{ vars.REMOTE_CONFIG_URL }}
42
+
43
+ - name : Commit the file and Create PR
44
+ env :
45
+ GIT_AUTHOR_NAME : ${{ steps.import-gpg.outputs.name }}
46
+ GIT_AUTHOR_EMAIL : ${{ steps.import-gpg.outputs.email }}
47
+ GIT_COMMITTER_NAME : ${{ steps.import-gpg.outputs.name }}
48
+ GIT_COMMITTER_EMAIL : ${{ steps.import-gpg.outputs.email }}
49
+ run : |
50
+ if [ -z "$(git status --porcelain)" ]; then
51
+ echo "No changes to commit, Not creating a PR."
52
+ else
53
+ echo "Changes detected, creating a PR"
54
+
55
+ # Commit the newly downloaded file
56
+ cd $(git rev-parse --show-toplevel)
57
+ git add packages/api/src/remote_config.json
58
+ git commit -m "🤖 Remote Config file update 🤖"
59
+
60
+ # Force push to this branch in case a previous run created it.
61
+ git push --set-upstream origin "$REMOTE_CONFIG_BRANCH" -f
62
+
63
+ sudo apt install gh
64
+ gh auth login --with-token <<< ${{ github.token }}
65
+ gh pr close "$REMOTE_CONFIG_BRANCH" || true
66
+ gh pr create --base "master" --title "Sync Remote Config File 🤖" --head "deriv-com:$REMOTE_CONFIG_BRANCH" --body "This is an automated Pull Request designed to synchronize our project's Remote Config from Its origin. It checks for the changes in the remote config URL and in case of any change, it will update it using this PR."
67
+ fi
68
+ shell : bash
0 commit comments