Pull Request Factory #23560
This file contains hidden or 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: Pull Request Factory | |
| on: | |
| workflow_dispatch: {} | |
| schedule: | |
| - cron: "*/30 * * * *" | |
| jobs: | |
| merge-pr: | |
| runs-on: [ubuntu-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: trunk install | |
| uses: trunk-io/trunk-action/install@v1 | |
| with: | |
| tools: gh | |
| - name: Merge active change | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| id: merge | |
| run: javascript/src/season/merge_next | |
| create-pr: | |
| needs: merge-pr | |
| runs-on: [ubuntu-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: run switch season | |
| id: switch | |
| run: javascript/src/season/flip | |
| - 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=ELI_PAT" >> $GITHUB_OUTPUT | |
| echo "title=Rabbit 🐇" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Get current date | |
| id: date | |
| run: | | |
| echo "month=$(date +'%B')" >> $GITHUB_OUTPUT | |
| echo "day=$(date +'%d')" >> $GITHUB_OUTPUT | |
| - 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.date.outputs.month }} ${{ steps.date.outputs.day }} is ${{ steps.switch.outputs.season }} season | |
| labels: ${{ steps.switch.outputs.season }} | |
| branch: ${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}/season |