Skip to content

Commit

Permalink
re-work action
Browse files Browse the repository at this point in the history
  • Loading branch information
alterationx10 committed Jan 23, 2025
1 parent 82a811d commit 982ddfb
Showing 1 changed file with 40 additions and 9 deletions.
49 changes: 40 additions & 9 deletions .github/workflows/updates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,50 @@ jobs:
update:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: coursier/cache-action@v6.4
- uses: VirtusLab/scala-cli-setup@v1.5

- name: Create a new branch
run: git checkout -b dependency-update
- name: Setup coursier cache
uses: coursier/cache-action@v6.4

- run: scala-cli --power dependency-update branch --all
- name: Setup Scala CLI
uses: VirtusLab/scala-cli-setup@v1.5

- run: |
- name: Check if branch exists on remote
id: branch-check
run: |
if git ls-remote --exit-code --heads origin dependency-update; then
echo "branch_exists=true" >> $GITHUB_ENV
else
echo "branch_exists=false" >> $GITHUB_ENV
fi
- name: Track or create branch
run: |
if [ "$branch_exists" = "true" ]; then
git fetch origin dependency-update:dependency-update
git checkout dependency-update
else
git checkout -b dependency-update
fi
- name: Update dependencies
run: |
scala-cli --power dependency-update branch --all
git commit -am "Update dependencies" || echo "No changes to commit"
- name: Push changes
run: |
git push -u origin dependency-update
gh pr create --title "Dependency Updates" --body "Dependency updates from scala-cli" --fill
- name: Create a Pull Request
run: |
gh pr create \
--title "Dependency Updates" \
--body "Dependency updates from scala-cli" \
--head dependency-update \
--base main || echo "Pull request already exists or no changes to push"

0 comments on commit 982ddfb

Please sign in to comment.