-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (55 loc) · 1.92 KB
/
get_discussions.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: run get_discussions.py
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo content
uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: execute py script
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python manage_discussions/get_discussions.py
- name: Check for changes
id: check_changes
run: |
git diff --exit-code tech_radar/blips.json || echo "blips.json modified"
continue-on-error: true
- name: Detect if changes were made
id: changes_detected
run: |
git diff --exit-code tech_radar/blips.json
if [ $? -ne 0 ]; then
echo "::set-output name=changed::true"
else
echo "::set-output name=changed::false"
fi
- name: Commit changes if any
if: steps.changes_detected.outputs.changed == 'true'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b update-blips-branch
git add blips.json
git commit -m "Auto-update blips.json"
- name: Push changes to new branch
if: steps.changes_detected.outputs.changed == 'true'
run: |
git push origin update-blips-branch
- name: Create Pull Request
if: steps.changes_detected.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v5
with:
branch: update-blips-branch
title: 'Auto-update blips.json'
body: 'This PR updates the blips.json file automatically.'
labels: 'auto-update'