Updating tech options according to the latest github templates #153
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: update-tech-options | |
run-name: Updating tech options according to the latest github templates | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 3 * * 1' | |
jobs: | |
update-tech-options: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- name: Delete branch | |
run: | | |
git push origin --delete update-tech-options | |
continue-on-error: true | |
- name: Recreate branch | |
run: | | |
git checkout -b update-tech-options | |
- name: Clone toptal templates | |
run: | | |
yarn clone-templates | |
- name: Run the prebuild script | |
run: yarn update-tech-options | |
- name: Check for changes | |
id: git-check | |
run: | | |
git diff --quiet || echo "::set-output name=has_changes::true" | |
- name: Commit changes | |
if: steps.git-check.outputs.has_changes == 'true' | |
run: | | |
git config --global user.name "FilipLunski" | |
git config --global user.email "[email protected]" | |
git add -A | |
git commit -m "Update tech options $(date +%Y-%m-%d_%H:%M:%S)" | |
git push origin update-tech-options | |
- name: Create Pull Request | |
if: steps.git-check.outputs.has_changes == 'true' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh pr create --title "Update tech options $(date +%Y-%m-%d_%H:%M:%S)" --body "Automatic update of tech options using github actions" --base main --head update-tech-options | |
- name: Create Empty Pull Request | |
if: steps.git-check.outputs.has_changes == 'false' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh pr create --title "Tech options without change $(date +%Y-%m-%d_%H:%M:%S)" --body "Automatic update of tech options using github actions, nothing changed" --base main --head update-tech-options |