PR Factory #11457
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: PR Factory | |
on: | |
workflow_dispatch: {} | |
schedule: | |
- cron: "*/30 * * * *" | |
jobs: | |
merge-pr: | |
runs-on: [self-hosted, macOS] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: trunk install | |
uses: trunk-io/trunk-action/install@v1 | |
- name: Merge active change | |
env: | |
GH_TOKEN: ${{ github.token }} | |
id: merge | |
run: javascript/src/season/merge_next | |
create-pr: | |
needs: merge-pr | |
runs-on: [self-hosted, macOS] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
- name: trunk install | |
uses: trunk-io/trunk-action/install@v1 | |
- name: run switch season | |
id: switch | |
run: javascript/src/season/flip | |
- name: run test generator | |
run: cargo run --manifest-path=./rust/Cargo.toml | |
- name: choose next | |
id: choose-next | |
run: | | |
if [[ "${{ steps.switch.outputs.season }}" == "Duck" ]]; then | |
echo "secret_name=ELI_PAT" >> $GITHUB_OUTPUT | |
echo "title=Duck 🦆" >> $GITHUB_OUTPUT | |
else | |
echo "secret_name=JOSH_PAT" >> $GITHUB_OUTPUT | |
echo "title=Rabbit 🐇" >> $GITHUB_OUTPUT | |
fi | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets[steps.choose-next.outputs.secret_name] }} | |
commit-message: Everyone knows its ${{ steps.switch.outputs.season }} | |
title: ${{ steps.choose-next.outputs.title }} season | |
body: ${{ steps.switch.outputs.season }} season | |
labels: ${{ steps.switch.outputs.season }} | |
branch: eli/season |