Skip to content

Commit db65df4

Browse files
gha: trigger update rules manually (#2200)
* manual workflow to update rules Signed-off-by: habibayassin <[email protected]> Signed-off-by: Vitor Bandeira <[email protected]> Co-authored-by: Vitor Bandeira <[email protected]>
1 parent 1fef313 commit db65df4

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Manually Trigger Update Rules
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
type:
6+
description: 'Type of update (overwrite or normal)'
7+
required: true
8+
default: 'normal'
9+
10+
jobs:
11+
update:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
steps:
16+
- name: Check out repository code recursively
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.10"
23+
- name: Install Python Packages
24+
run: |
25+
pip install firebase-admin
26+
- name: Execute Python Script Update
27+
env:
28+
CREDS_FILE: ${{ secrets.CREDS_FILE }}
29+
API_BASE_URL: ${{ secrets.API_BASE_URL }}
30+
run: |
31+
if [[ "${{ github.event.inputs.type }}" == "overwrite" ]]; then
32+
python flow/util/updateRules.py --keyFile "${CREDS_FILE}" --apiURL ${API_BASE_URL} --commitSHA $(git rev-parse HEAD) --overwrite
33+
else
34+
python flow/util/updateRules.py --keyFile "${CREDS_FILE}" --apiURL ${API_BASE_URL} --commitSHA $(git rev-parse HEAD)
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+
if [ -n "$(git status --porcelain)" ]; then
42+
echo "has_update=true" >> "$GITHUB_OUTPUT"
43+
else
44+
echo "has_update=false" >> "$GITHUB_OUTPUT"
45+
fi
46+
git add .
47+
git commit --signoff -m "flow: update rules based on new golden reference"
48+
- if: "steps.remote-update.outputs.has_update == 'true'"
49+
name: update rules pr
50+
id: remote-update-pr
51+
run: |
52+
git push

0 commit comments

Comments
 (0)