-
-
Notifications
You must be signed in to change notification settings - Fork 0
Update dependabot actions #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Dependabot Auto Approve | ||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - reopened | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| auto-approve: | ||
| runs-on: ubuntu-latest | ||
| if: github.actor == 'dependabot[bot]' || github.actor == 'nev21' | ||
| steps: | ||
| - name: Wait for status checks | ||
| uses: lewagon/wait-on-check-action@v1.4.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
| wait-interval: 30 | ||
| running-workflow-name: 'auto-approve' | ||
| allowed-conclusions: success,skipped,neutral | ||
|
|
||
| - name: Approve PR | ||
| if: success() | ||
| run: gh pr review --approve "$PR_URL" | ||
| env: | ||
| PR_URL: ${{ github.event.pull_request.html_url }} | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Sync Rush.json Version | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize] | ||
| paths: | ||
| - "**/package.json" | ||
| - "rush.json" | ||
| - "common-versions.json" | ||
|
|
||
| jobs: | ||
| detect: | ||
| runs-on: ubuntu-latest | ||
| if: github.actor == 'dependabot[bot]' | ||
| outputs: | ||
| rush_changed: ${{ steps.detect.outputs.rush_changed }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Detect Rush bump | ||
| id: detect | ||
| run: | | ||
| # Look for @microsoft/rush in the diff | ||
| if git diff -U0 HEAD~1 -- **/package.json | grep '"@microsoft/rush"'; then | ||
| echo "rush_changed=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "rush_changed=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| update: | ||
| runs-on: ubuntu-latest | ||
| needs: detect | ||
| if: needs.detect.outputs.rush_changed == 'true' | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 20 | ||
|
|
||
| - name: Install Rush | ||
| run: npm install -g @microsoft/rush | ||
|
|
||
| - name: Sync rush.json | ||
| run: | | ||
| echo "Syncing rush.json with Dependabot bump..." | ||
| # Extract new Rush version from package.json | ||
| NEW_VERSION=$(jq -r '.devDependencies["@microsoft/rush"] // .dependencies["@microsoft/rush"]' package.json) | ||
|
||
|
|
||
| # Update rush.json version field | ||
| jq ".rushVersion = \"$NEW_VERSION\"" rush.json > rush.tmp.json | ||
| mv rush.tmp.json rush.json | ||
|
|
||
| - name: Run rush update | ||
| run: | | ||
| rush update --full | ||
|
|
||
| - name: Commit changes | ||
| run: | | ||
| git config --global user.name "dependabot-sync[bot]" | ||
| git config --global user.email "dependabot-sync[bot]@users.noreply.github.com" | ||
| git add rush.json || true | ||
| git add common-versions.json || true | ||
| git add pnpm-lock.yaml || true | ||
| git add yarn.lock || true | ||
| git add package-lock.json || true | ||
| if git diff --staged --quiet; then | ||
| echo "No changes to commit." | ||
| else | ||
| git commit -m "chore: sync rush.json and regenerate lockfiles" | ||
| git push --force-with-lease | ||
|
||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The git diff command assumes HEAD
1 exists, which will fail on the first commit of a new branch or repository. Consider using 'origin/${{ github.base_ref }}' or checking if HEAD1 exists before running the diff.