chore(deps-dev): bump the client-angular-eslint group with 3 updates #776
Workflow file for this run
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: 'PR: Dependabot auto-merge' | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
workflow_dispatch: | |
inputs: | |
pr_number: | |
description: 'Pull Request number' | |
required: false | |
default: '' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
dependabot-check: | |
name: 'Dependabot Check' | |
runs-on: ubuntu-latest | |
outputs: | |
dependency-names: ${{ steps.metadata.outputs.dependency-names }} | |
update-type: ${{ steps.metadata.outputs.update-type }} | |
dependency-versions: ${{ steps.metadata.outputs.new-version }} | |
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]'}} | |
steps: | |
- name: Fetch dependabot metadata | |
id: metadata | |
uses: dependabot/[email protected] | |
with: | |
github-token: '${{ secrets.GITHUB_TOKEN }}' | |
skip-commit-verification: true | |
nx-migrate: | |
name: 'NX Migrate' | |
runs-on: ubuntu-latest | |
needs: dependabot-check | |
if: always() && | |
(github.event.action == 'opened') && | |
(contains(needs.dependabot-check.outputs.dependency-names, '@nx/') || contains(needs.dependabot-check.outputs.dependency-names, 'nx') || contains(needs.dependabot-check.outputs.dependency-names, '@nx-dotnet/core')) | |
steps: | |
- name: 'Checkout code if nx or nx-dotnet' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: 'Run npm install' | |
run: | | |
npm i | |
working-directory: ${{ github.workspace }} | |
- name: Set user to github actions | |
run: | | |
git config --global user.email "dependabot[bot]@users.noreply.github.com" | |
git config --global user.name "dependabot[bot]" | |
- name: 'Get nx version' | |
id: nx-version | |
run: | | |
NX_VERSION= ${{ needs.dependabot-check.outputs.dependency-versions }} || { echo "Failed to get nx version" >&2; exit 1; } | |
echo "nx-version=$NX_VERSION" >> $GITHUB_OUTPUT | |
- name: 'Set nx version in package.json' | |
run: | | |
jq --arg version "${{ steps.nx-version.outputs['nx-version'] }}" '.version = $version' package.json > tmp.$$.json && mv tmp.$$.json package.json || echo "Failed to update package.json version" >&2 | |
- name: 'Run nx migrate and create commits' | |
run: | | |
npx nx migrate ${{ steps.nx-version.outputs['nx-version'] }} | |
npx nx migrate --run-migrations --create-commits --if-exists | |
npx nx migrate @nx-dotnet/core | |
npx nx migrate --run-migrations --create-commits --if-exists | |
if [ -f migrations.json ]; then rm -rf migrations.json; fi | |
- name: Running rest of commits | |
run: | | |
npm i | |
npx nx run-many -t lint --fix | |
npm i | |
git fetch origin main | |
npm run format:write | |
git add . | |
- name: 'Check for changes, push if there are' | |
id: check-changes | |
run: | | |
# Fetch the main branch | |
git fetch origin main | |
# Check for differences between the current branch and the main branch | |
if git diff --exit-code HEAD origin/main; then | |
echo "No changes found" | |
else | |
echo "Changes found" | |
git add . | |
git commit -m "chore(deps): nx migrate" | |
git push origin ${{ github.event.pull_request.head.ref }} --force | |
fi | |
continue-on-error: true | |
auto-merge-and-review: | |
name: 'Enable Auto-Merge' | |
runs-on: ubuntu-latest | |
needs: [dependabot-check, nx-migrate] | |
if: always() && | |
(needs.dependabot-check.outputs.update-type == 'version-update:semver-minor' || needs.dependabot-check.outputs.update-type == 'version-update:semver-patch') && | |
(needs.nx-migrate.result == 'success' || needs.nx-migrate.result == 'skipped') | |
steps: | |
- name: 'Enable auto-merge for minor/patch updates' | |
id: enable-automerge | |
run: gh pr merge --auto --squash "$PR_URL" | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 'Review PR with approval' | |
run: | | |
gh pr review "$PR_URL" --approve --body "This dependency update can be auto-merged since it's a minor or patch version update." | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 'Comment on PR' | |
run: | | |
gh pr comment "$PR_URL" --body "This dependency update was not auto-merged as this is a major version update, please review manually." | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |