Try Update GraphQL Schema #105
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: Try Update GraphQL Schema | |
on: | |
schedule: | |
# Every day at 11:45 | |
- cron: "45 11 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
try-update-graphql-schema: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: actions/checkout@v4 | |
- env: | |
S21_USERNAME: ${{ secrets.S21_USERNAME }} | |
S21_PASSWORD: ${{ secrets.S21_PASSWORD }} | |
run: | | |
rm -rf ./schema | |
npx @s21toolkit/introspector @ $(npx @s21toolkit/introspector auth $S21_USERNAME $S21_PASSWORD) --isolate-operations -o ./schema | |
- id: diff | |
run: | | |
if [ "$(git add --all --dry-run ./schema | head -1 | wc -l)" -eq 1 ]; then | |
echo "changed=true" >> $GITHUB_OUTPUT; | |
echo "version=$(npx @s21toolkit/introspector static -n -s PRODUCT_VERSION)" >> $GITHUB_OUTPUT; | |
else | |
echo "changed=false" >> $GITHUB_OUTPUT; | |
fi | |
- if: steps.diff.outputs.changed == 'true' | |
env: | |
VERSION: ${{ steps.diff.outputs.version }} | |
run: | | |
git config user.name s21toolkit | |
git config user.email [email protected] | |
git add ./schema | |
git commit -m "feat(schema): $VERSION" | |
git push | |
git tag "v/$VERSION" | |
git push --tags |