Open Issue when Netbox releases a new version #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Open Issue when Netbox releases a new version | |
on: | |
schedule: | |
- cron: 2 * * * * | |
jobs: | |
create_issue: | |
name: Create team sync issue | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: Create team sync issue | |
run: | | |
previous_issue_date=$(gh issue list \ | |
--json createdAt \ | |
-s all \ | |
-S '[Chore]: Upgrade Netbox to' \ | |
-L 1 \ | |
--jq '.[0].createdAt' \ | |
| tr -d '"') | |
new_release=$(gh release list -R netbox-community/netbox \ | |
--exclude-drafts \ | |
--exclude-pre-releases \ | |
--json publishedAt,tagName \ | |
--jq '.[0]') | |
new_release_tag=$(echo $new_release | jq '.tagName' | tr -d '"') | |
new_release_date=$(echo $new_release | jq '.publishedAt' | tr -d '"') | |
if [[ "$previous_issue_date" > "$new_release_date" ]]; then | |
gh issue create \ | |
--title "[Chore]: Upgrade netbox to $new_release_tag" \ | |
--body "$(gh release view $new_release_tag --repo netbox-community/netbox --json body --jq '.body')" | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |