-
Notifications
You must be signed in to change notification settings - Fork 950
69 lines (69 loc) · 2.79 KB
/
update-generated-schema.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
66
67
68
69
---
name: Gather New NetBox Generated Schema JSON
on:
schedule:
- cron: 0 */12 * * *
jobs:
schema-update:
runs-on: ubuntu-latest
permissions:
actions: write
issues: write
pull-requests: write
contents: write
steps:
- name: Get NetBox Latest Release
id: netbox-release
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: netbox-community/netbox
- uses: actions/checkout@v4
with:
submodules: true
if: ${{ steps.netbox-release.outputs.release != vars.SCHEMA_VERSION }}
- name: Setup Python
uses: actions/setup-python@v5
id: setup_python
with:
python-version: '3.9'
if: ${{ steps.netbox-release.outputs.release != vars.SCHEMA_VERSION }}
- name: cache virtualenv
uses: actions/cache@v4
id: cache-venv
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.pythonLocation }}-
if: ${{ steps.netbox-release.outputs.release != vars.SCHEMA_VERSION }}
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
if: ${{ steps.cache-venv.outputs.cache-hit != 'true' && steps.netbox-release.outputs.release != vars.SCHEMA_VERSION }}
- name: Regenerate Master Slug List
run: python3 scripts/update-schema.py
if: ${{ steps.netbox-release.outputs.release != vars.SCHEMA_VERSION }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
commit-message: Regenerate master slug list after successful PR merge
committer: NetBox-Bot <[email protected]>
author: NetBox-Bot <[email protected]>
branch: ${{ steps.netbox-release.outputs.release }}
delete-branch: true
base: master
title: NetBox ${{ steps.netbox-release.outputs.release }} Generated Schema JSON
body: |
Adding generated_schema.json from NetBox ${{ steps.netbox-release.outputs.release }}
assignees: danner26
reviewers: danner26
if: ${{ steps.netbox-release.outputs.release != vars.SCHEMA_VERSION }}
# - name: Update Repository SCHEMA_VERSION
# uses: action-pack/set-variable@v1
# with:
# name: 'SCHEMA_VERSION'
# value: ${{ steps.netbox-release.outputs.release }}
# token: ${{ secrets.GITHUB_TOKEN }}
# if: ${{ steps.netbox-release.outputs.release != vars.SCHEMA_VERSION }}