Skip to content
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

Update pull-request.yml to Auto-Commit Changes in pubspec.lock #2707

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ jobs:
Flutter-Codebase-Check:
name: Checking codebase
runs-on: ubuntu-latest
permissions:
contents: write
#needs: PR-Greeting
steps:
- uses: actions/checkout@v4
with:
# ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-java@v4
with:
distribution: 'zulu' # See 'Supported distributions' for available options
Expand All @@ -43,6 +46,23 @@ jobs:
run: cd talawa_lint && flutter pub get && cd ..
- name: Running pub get to fetch dependencies
run: flutter pub get
- name: Check and commit pubspec.lock changes
env:
HEAD_REF: ${{ github.head_ref }}
run: |
if [[ $(git status --porcelain pubspec.lock) ]]; then
echo "Changes detected in pubspec.lock. Auto-committing updates."
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
may-tas marked this conversation as resolved.
Show resolved Hide resolved
git add pubspec.lock
git commit -a -m "chore: Auto-update pubspec.lock in PR #${{ github.event.pull_request.number }}"
if ! git push origin HEAD:"$HEAD_REF"; then
echo "Failed to push changes. Please check if you have the correct permissions."
exit 1
fi
else
echo "No changes in pubspec.lock."
fi
may-tas marked this conversation as resolved.
Show resolved Hide resolved
- name: Checking for correct formatting of code
run: dart format --set-exit-if-changed .
- name: Count lines of code in each file
Expand All @@ -58,7 +78,6 @@ jobs:
git branch
git checkout -b temp_branch
git branch
git stash push -m lock_file pubspec.lock
git checkout develop-postgres
git pull
git branch
Expand Down
Loading