Skip to content

Commit

Permalink
Fix dependabot workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofranssen committed Oct 10, 2022
1 parent d26cdd1 commit 88a073f
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/update-dist.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
name: Dependabot PR
on:
pull_request:
types: [opened, synchronize, edited, reopened]
branches:
- dependabot/**
types: [opened, reopened, synchronize]

jobs:
print-info:
name: Update dist
runs-on: ubuntu-22.04

steps:
- name: Print PR info
run: |
echo Ref: ${{ github.ref }}
echo Head-Ref: ${{ github.head_ref }}
echo Actor: ${{ github.actor }}
update-dist:
name: Update dist
runs-on: ubuntu-22.04
if: >
startsWith(github.head_ref, 'dependabot/npm_and_yarn') &&
startsWith(github.ref, 'refs/heads/dependabot/npm_and_yarn') &&
github.actor == 'dependabot[bot]'
needs: [print-info]

permissions:
contents: write

Expand All @@ -37,7 +48,7 @@ jobs:
run: yarn build

- name: Commit new dist
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v4.15.0
with:
file_pattern: dist
commit_message: Build dist
Expand All @@ -46,7 +57,7 @@ jobs:
name: Update dist
runs-on: ubuntu-22.04
if: >
startsWith(github.head_ref, 'dependabot/npm_and_yarn') &&
startsWith(github.ref, 'refs/heads/dependabot/npm_and_yarn') &&
github.actor == 'dependabot[bot]'
needs: [update-dist]
Expand All @@ -65,7 +76,7 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve a PR
if: ${{ steps.dependabot-metadata.outputs.update-type == "version-update:semver-patch" }}
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' }}
run: |
gh pr checkout "$PR_URL"
[ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ] \
Expand Down

0 comments on commit 88a073f

Please sign in to comment.