Skip to content

Commit 11bf611

Browse files
authored
Merge pull request #1519 from habibayassin/update-rules
gha: automatic rules update
2 parents 5eda0a9 + 77ba0c9 commit 11bf611

File tree

3 files changed

+427
-264
lines changed

3 files changed

+427
-264
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Create draft PR for updated rules
2+
on:
3+
repository_dispatch:
4+
types:
5+
- set-new-golden
6+
7+
jobs:
8+
update:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
steps:
13+
- name: Check out repository code recursively
14+
uses: actions/checkout@v3
15+
with:
16+
submodules: recursive
17+
fetch-depth: 0
18+
- uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.10"
21+
- name: Install Python Packages
22+
run: |
23+
pip install firebase-admin
24+
- name: Execute Python Script Update
25+
env:
26+
CREDS_FILE: ${{ secrets.CREDS_FILE }}
27+
API_BASE_URL: ${{ secrets.API_BASE_URL }}
28+
run: |
29+
echo ${{ github.event_name }}
30+
echo ${{ github.event.client_payload.type }}
31+
if [[ "${{ github.event_name }}" == "repository_dispatch" && "${{ github.event.client_payload.type }}" == "overwrite" ]]; then
32+
python flow/util/updateRules.py --keyFile "${CREDS_FILE}" --apiURL ${API_BASE_URL} --overwrite
33+
else
34+
python flow/util/updateRules.py --keyFile "${CREDS_FILE}" --apiURL ${API_BASE_URL}
35+
fi
36+
- name: Push updated rules
37+
id: remote-update
38+
run: |
39+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
40+
git config --local user.name "github-actions[bot]"
41+
echo "::set-output name=has_update::$(git --no-pager diff --name-only origin/master..HEAD)"
42+
git add .
43+
git commit -m "flow: update rules based on new golden reference"
44+
- if: "steps.remote-update.outputs.has_update != ''"
45+
name: Create Draft PR
46+
uses: peter-evans/create-pull-request@v5
47+
with:
48+
token: ${{ github.token }}
49+
signoff: true
50+
delete-branch: true
51+
title: "[BOT] Update rules"
52+
reviewers: |
53+
vvbandeira
54+
maliberty
55+
draft: true
56+
branch: bot-update-rules
57+
commit-message: |
58+
[BOT] Update rules

0 commit comments

Comments
 (0)