From 90dc7aab91276ac38471d20a2fa59c636e3ab9ae Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sun, 14 Apr 2024 09:53:22 +0300 Subject: [PATCH] ci(update): fix workflow --- .github/workflows/update.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 9b04b97..2540440 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -15,13 +15,18 @@ jobs: - name: Fetch dependabot metadata id: metadata uses: dependabot/fetch-metadata@v2 + - name: Checkout repository + uses: actions/checkout@v4 + if: steps.metadata.outputs.package-ecosystem == 'npm_and_yarn' + with: + ref: ${{github.head_ref}} - name: Regenerate parser - if: steps.metadata.outputs.package-ecosystem == 'npm' + if: steps.metadata.outputs.package-ecosystem == 'npm_and_yarn' run: |- npm ci --legacy-peer-deps npm x -- tree-sitter generate --no-bindings - name: Update scanner - if: steps.metadata.outputs.package-ecosystem == 'npm' + if: steps.metadata.outputs.package-ecosystem == 'npm_and_yarn' run: |- language=$(jq -r .name src/grammar.json) parent=$(gh api --jq '.[]|select(.property_name == "Inherits")|.value' $API_ENDPOINT) @@ -31,15 +36,11 @@ jobs: GH_TOKEN: ${{github.token}} API_ENDPOINT: repos/${{github.repository}}/properties/values - name: Commit changes - if: steps.metadata.outputs.package-ecosystem == 'npm' + if: steps.metadata.outputs.package-ecosystem == 'npm_and_yarn' run: |- - if ! git diff --exit-code -- src && git add src; then + if ! git diff --quiet -- src && git add src; then git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR_ID+$GITHUB_ACTOR@users.noreply.github.com" - git commit -m 'build: regenerate parser [dependabot skip]' && git push + git commit -m 'build: regenerate parser [dependabot skip]' + git push origin HEAD:$GITHUB_HEAD_REF fi - - name: Enable auto-merge - run: gh pr merge --auto --merge $PR_URL - env: - GH_TOKEN: ${{github.token}} - PR_URL: ${{github.event.pull_request.html_url}}