This repository has been archived by the owner on Nov 16, 2024. It is now read-only.
Update code #313
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
# Github workflow to update the code when the bot API is updated. | |
# Runs every day, and can be manually triggered. | |
# On trigger, runs the generate script at `scripts/generate.cr`, commits the changes (if any) to the `develop` branch, | |
# and opens a pull request to merge the changes into `master`. | |
name: Update code | |
on: | |
workflow_dispatch: {} # Allow manual triggering | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
crystal-version: [1.10.1] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: develop | |
- uses: oprypin/install-crystal@v1 | |
with: | |
crystal: ${{ matrix.crystal-version }} | |
- name: Install dependencies | |
run: shards install | |
- name: Generate code | |
id: generate | |
run: crystal scripts/generate.cr | |
- name: Format code | |
run: crystal tool format | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "Chris Watson" | |
git add . | |
git commit -am "bot api update" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: develop | |
- name: Create pull request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "bot api update" | |
title: "bot api update" | |
body: ${{ steps.generate.outputs.output }} | |
branch: develop | |
base: master |