Skip to content
name: Update CoW Dependencies
on:
workflow_dispatch:
push:
branches:
- update-cow-dependencies-action
schedule:
# At 00:00 on Wednesday
- cron: "0 0 * * 3"
jobs:
update-dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
- name: Get latest release tag from CoW protocol services
id: latest-tag
run: |
TAG=$(curl -s https://api.github.com/repos/cowprotocol/services/releases/latest | jq -r '.tag_name')
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Create branch
run: |
git checkout -b update-cow-dependencies/${{ env.TAG }}
- name: Update Cargo.toml
run: |
sed -i '/git = "https:\/\/github.com\/cowprotocol\/services.git"/s/tag = "v[0-9]*\.[0-9]*\.[0-9]*"/tag = "${{ env.TAG }}"/g' ./Cargo.toml
- name: Update Cargo.lock
run: cargo update
- name: Commit changes
run: |
git config --global user.name 'Your Name'
git config --global user.email 'your-email@example.com'
git add Cargo.toml Cargo.lock
git commit -m "Update CoW dependencies to ${{ env.TAG }}"
git push --set-upstream origin update-cow-dependencies/${{ env.TAG }}
- name: Extract commit message
id: commit
run: |
echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
echo "pr_body=Updated CoW dependencies to ${{ env.TAG }}" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ steps.commit.outputs.branch }}
destination_branch: "main"
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: "Update CoW dependencies to ${{ env.TAG }}"
pr_body: "${{ steps.commit.outputs.pr_body }}"