Skip to content

Commit

Permalink
Alternative mechanism to fix Dependabot issue. (#390)
Browse files Browse the repository at this point in the history
* Revert "Fix Dependabot issue where modified lock files are not committed. (#389)"

This reverts commit 334c739.

* Let's try something else.

* Stage changes first 😬

* Committing changes to lock files

* Fix workflow error.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
AjayKMehta and github-actions[bot] authored Jan 27, 2025
1 parent 7d167dc commit 4118599
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 23 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,27 @@ jobs:
name: Install dependencies
run: |
if [[ "${{ github.event.pull_request.user.login }}" == 'dependabot[bot]' ]] || [[ "${{ github.actor }}" == 'dependabot[bot]' ]]; then
dotnet restore --force-evaluate
if git status --porcelain | grep -q .; then
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global commit.gpgsign false
git add ./\*.lock.json
git commit -m "Committing changes to lock files"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
else
echo "No changes detected"
fi
dotnet restore --force-evaluate && git add .
else
dotnet restore --locked-mode
fi
- id: commit
if: matrix.build-mode == 'manual' && env.ENABLED == '1'
uses: qoomon/actions--create-commit@v1
with:
message: "Committing changes to lock files [skip ci]"
allow-empty: false
skip-empty: true

- if: matrix.build-mode == 'manual' && env.ENABLED == '1' && steps.commit.outputs.commit != null
run: git push origin ${{ github.head_ref || github.ref_name }}

- name: Install dependencies
if: env.ENABLED == '1' && steps.pr-check.outputs.pr_found == 'false'
run: |
dotnet restore --locked-mode
- if: matrix.build-mode == 'manual' && env.ENABLED == '1'
name: Build
run: dotnet build --configuration Release --no-restore --tl
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/infersharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "Infersharp"
on: [workflow_dispatch, pull_request ]

permissions:
contents: write
contents: read
security-events: write

jobs:
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,19 @@ jobs:
- name: Install dependencies
if: env.ENABLED == '1' && steps.pr-check.outputs.pr_found == 'true'
run: |
dotnet restore --force-evaluate
if git status --porcelain | grep -q .; then
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global commit.gpgsign false
git add ./\*.lock.json
git commit -m "Committing changes to lock files"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
else
echo "No changes detected"
fi
dotnet restore --force-evaluate && git add .
- id: commit
if: env.ENABLED == '1' && steps.pr-check.outputs.pr_found == 'true'
uses: qoomon/actions--create-commit@v1
with:
message: "Committing changes to lock files [skip ci]"
allow-empty: false
skip-empty: true

- if: env.ENABLED == '1' && steps.pr-check.outputs.pr_found == 'true' && steps.commit.outputs.commit != null
run: git push origin HEAD:${{ github.head_ref || github.ref_name }}

- name: Install dependencies
if: env.ENABLED == '1' && steps.pr-check.outputs.pr_found == 'false'
Expand Down

0 comments on commit 4118599

Please sign in to comment.