Deps #400
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deps | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
NewtonsoftJson: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Check version | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
id: check | |
run: | | |
v=$(curl 'https://azuresearch-usnc.nuget.org/query?q=Newtonsoft.Json' | jq -r '.data[] | select(.id == "Newtonsoft.Json") | .version' | sed -r "s/(.*)\.(.*)$/\1.*/") | |
sed -i -r "s/Include=\"Newtonsoft.Json\" Version=\"\[(.*),\)\"/Include=\"Newtonsoft.Json\" Version=\"[$v,)\"/g" src/ODataHttpClient/ODataHttpClient.csproj | |
pr_title="Newtonsoft.Json.$v" | |
base_branch=master | |
echo "::set-output name=diff::$(git diff --name-only | wc -l)" | |
echo "::set-output name=count::$(gh pr list -S ${pr_title}' in:title' -B $base_branch | wc -l)" | |
echo "::set-output name=pr_title::$pr_title" | |
echo "::set-output name=base_branch::$base_branch" | |
- name: Push branch | |
if: ${{ steps.check.outputs.count == 0 && steps.check.outputs.diff > 0 }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git checkout -b deps/${{ steps.check.outputs.pr_title }} | |
git commit -am "bumpup deps" | |
git push origin deps/${{ steps.check.outputs.pr_title }} | |
- name: Create release pr | |
if: ${{ steps.check.outputs.count == 0 && steps.check.outputs.diff > 0 }} | |
env: | |
GH_TOKEN: ${{ secrets.PR_GITHUB_TOKEN }} | |
run: | | |
gh pr create -B ${{ steps.check.outputs.base_branch }} -t ${{ steps.check.outputs.pr_title }} -b "" |