Build types every Friday evening #101
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: Build types every Friday evening | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "42 21 * * 5" | |
env: | |
NODE_VERSION: "20.11.0" | |
PNPM_VERSION: "8.15.0" | |
jobs: | |
update_types: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build geoview-core to update types | |
run: | | |
npm install -g @microsoft/rush | |
rush update | |
rush build:core | |
- name: Create new branch with just types and package.json | |
run: | | |
exists=$(git ls-remote --heads origin new-types | wc -l) | |
if [ ${exists} != 0 ]; | |
then | |
echo "Delete branch new-types (and close associated PR, if necessary) and run the action again." | |
exit 1 | |
fi | |
git checkout types | |
git checkout -b new-types | |
rm -r src | |
cp -r ./packages/geoview-core/types/* ./ | |
rm -r common | |
rm -r packages | |
git config --global user.name $USER | |
git add . | |
git status | |
CHANGES=$(git status -s | wc -l) | |
if [ $CHANGES == 0 ]; | |
then | |
echo "No changes made." | |
exit 1 | |
fi | |
git commit -m "types updated" | |
git push -u origin HEAD:new-types | |
- name: Open pull request to types branch | |
uses: repo-sync/pull-request@v2 | |
with: | |
source_branch: "new-types" | |
destination_branch: "types" | |
pr_title: "Update to types" | |
pr_body: | | |
*An automated PR* - please delete branch after merge |