Generate #57
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: Generate | |
on: | |
schedule: | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule | |
# Runs every Monday at 00:00 | |
- cron: '0 0 * * 1' | |
workflow_dispatch: | |
jobs: | |
generate: | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
env: | |
# the version of deno used by Run on Slack (v1.31.1) | |
deno-version: v1.31.1 # TODO source this dynamicly from https://api.slack.com/slackcli/metadata.json | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v4 | |
- name: Setup Deno ${{ env.deno-version }} | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ env.deno-version }} | |
- name: Setup Git config | |
run: | | |
git config user.name github-actions | |
git config user.email ${{ secrets.APPROVED_ACCOUNT }} | |
- name: Set BRANCH_NAME | |
# example: BRANCH_NAME=generate_2023-07-18_18-09 | |
run: echo "BRANCH_NAME=generate_$(date +"%Y-%m-%d_%H-%M")" >> $GITHUB_ENV | |
- name: Run generation script | |
run: ./scripts/generate | |
- name: Commit changes | |
id: commit | |
continue-on-error: true | |
run: | | |
git checkout -b $BRANCH_NAME | |
[[ $(git ls-files --other --modified --exclude-standard) == "src/connectors/mod.ts" ]] && { echo "No real changes. Do not commit."; exit 1; } | |
git add --all | |
git commit -m "Automated commit: Latest generated changes from schedule action" | |
- name: Create Pull Request | |
if: ${{ steps.commit.outcome == 'success' }} | |
run: | | |
git push --set-upstream origin $BRANCH_NAME | |
gh pr create --label "enhancement" --title "Latest generated changes" --body \ | |
"## 🚀 Automated Pull Request: Coded-Connectors Update | |
This PR brings the latest changes to coded-connectors, fueled by Slack's latest data. Developers can now access the newest features effortlessly. | |
GitHub prevents [triggering a workflow from a workflow](https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow), the **checks** on this pull request will not be triggered automatically :sweat_smile: | |
To trigger the **checks** on this pull request: | |
1. close the pull request | |
2. reopen the pull request | |
*Github-Actions* 🤖" | |
env: | |
GH_TOKEN: ${{ github.token }} |