Skip to content

Autocreate robot profile if none exists #39

Autocreate robot profile if none exists

Autocreate robot profile if none exists #39

name: Autocreate robot profile if none exists
on:
schedule:
- cron: '0 5 1 4 *' # runs at 05:00 on the first day of April, right after the Season ends
workflow_dispatch:
# workflow_run:
# workflows: ["73393124"]
# types:
# - completed
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
pull-requests: write
actions: write
jobs:
create-robot-profile-if-not-exists:
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y')"
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: main
clean: false
- name: Run Script
run: python createRobotProfile.py
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
commit-message: Automatically Create Robot Profile
body: |
Do not merge this PR without first filling in the template this automated action has created
open [this link](https://github.com/Operation-P-E-A-C-C-E-Robotics/Operation-P-E-A-C-C-E-Robotics.github.io/edit/robot-profile-${{ steps.date.outputs.date }}/_robots/${{ steps.date.outputs.date }}.md) fill in the words that are in ALL CAPITAL LETTERS
once you have done that, hit save, commit the files to THIS BRANCH (named robot-profile-${{ steps.date.outputs.date }}), once you have commited the changes they should appear here on this pull request
once you verify the files are correct, approve the changes and merge the Pull Request to publish them to the internet.
after you merge the Pull Request, fill in any additional data at [this link](https://www.peacce.org/admin/#/collections/edit/robots/${{ steps.date.outputs.date }}) (if you need to login, login with the team github credentials) and set the published flag to true
title: Create a robot profile for ${{ steps.date.outputs.date }}
branch: robot-profile-${{ steps.date.outputs.date }}
- name: Fire CI-CD Action
uses: benc-uk/workflow-dispatch@v1
with:
ref: ${{ steps.cpr.outputs.pull-request-branch }}
workflow: 73393124
token: ${{ secrets.github_token }}
# merge-pr:
# runs-on: ubuntu-latest
# steps:
# - name: Approve Pull Request
# if: ${{ github.event_name == 'workflow_run'}}
# uses: juliangruber/approve-pull-request-action@v2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# number: ${{ steps.cpr.outputs.pull-request-number }}
# - name: Merge Pull Request
# if: ${{ github.event_name == 'workflow_run'}}
# uses: juliangruber/merge-pull-request-action@v1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# number: ${{ steps.cpr.outputs.pull-request-number }}
# method: squash # merge rebase