update-stdlib-specs #238
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 Ballerina Standard Library Specifications | |
on: | |
repository_dispatch: | |
types: [update-stdlib-specs] | |
jobs: | |
update-specs: | |
name: Update Spcefications | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
ref: master | |
- name: Set env variables | |
run: | | |
echo "Module Name: ${{ github.event.client_payload.module_name }}" | |
echo "Short Name: ${{ github.event.client_payload.short_name }}" | |
echo "File Directory Path: ${{ github.event.client_payload.file_dir }}" | |
echo MODULE_NAME=${{ github.event.client_payload.module_name }} >> $GITHUB_ENV | |
echo SHORT_NAME=${{ github.event.client_payload.short_name }} >> $GITHUB_ENV | |
echo FILE_DIR=${{ github.event.client_payload.file_dir }} >> $GITHUB_ENV | |
- name: Clone standard library repository | |
run: git clone https://github.com/ballerina-platform/$MODULE_NAME.git | |
- name: Update specifications | |
run: | | |
rm -rf spec/$SHORT_NAME | |
rm -rf public/spec/$SHORT_NAME | |
cp -r $FILE_DIR spec/$SHORT_NAME | |
cp -r $FILE_DIR public/spec/$SHORT_NAME | |
rm -rf $MODULE_NAME | |
- name: Push changes for new specifications | |
run: | | |
git checkout automate-specs-$SHORT_NAME-$GITHUB_SHA 2>/dev/null || git checkout -b automate-specs-$SHORT_NAME-$GITHUB_SHA | |
git config --global user.email "ballerina-bot@ballerina.org" | |
git config --global user.name "ballerina-bot" | |
git add spec | |
git add public/spec | |
git commit --allow-empty -m "Update ballerina standard library specifications" | |
git push --set-upstream origin automate-specs-$SHORT_NAME-$GITHUB_SHA | |
echo 'Successfully pushed to automate-specs-$GITHUB_SHA branch' | |
- name: Create pull request for new specifications | |
shell: bash | |
run: | | |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 | |
bin/hub pull-request -b master -m "[AUTOMATE] Update Ballerina Standard Library ($SHORT_NAME) Specifications" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |