-
Notifications
You must be signed in to change notification settings - Fork 179
51 lines (50 loc) · 1.73 KB
/
dependabot-glean-parser.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
47
48
49
50
51
name: Dependabot update glean-parser generated code
on:
pull_request:
branches: [ main ]
permissions:
contents: write
jobs:
regen-with-new-glean-parser:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && startsWith( github.head_ref, 'dependabot/pip/glean-parser' ) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Checkout pull request
run: gh pr checkout --recurse-submodules ${{ github.event.pull_request.number }}
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Set up Python 3
uses: actions/[email protected]
with:
python-version: '3.12'
cache: 'pip'
- name: Install Python dependencies
run: |
pip install -r requirements.txt
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Run glean-parser to regenerate code
run: .circleci/python_job.bash run build_glean
- name: Commit changed file
run: |
git config user.email "<>"
git config user.name "GitHub Actions - Run new glean-parser"
git add privaterelay/glean/server_events.py
has_changes=1
git commit --message="Re-generate code with glean-parser $GLEAN_VERSION" || has_changes=0
if (( has_changes == 0 ))
then
echo "no changes to push"
exit 0
fi
git push
env:
GLEAN_VERSION: ${{steps.dependabot-metadata.outputs.new-version}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}