-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check dependencies automatically once a day (#164)
- Loading branch information
1 parent
75ba04e
commit f197406
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash -e | ||
|
||
GITHUB_PR_LABEL="dependencies" | ||
|
||
if [ -z "$BRANCH_NAME" ]; then | ||
echo "Branch name is required" | ||
exit 1 | ||
fi | ||
|
||
function check_pr { | ||
gh pr list --state open --label "$GITHUB_PR_LABEL" | ||
} | ||
|
||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
|
||
_update_output="$(TERM=dumb rebar3 update-deps --replace)" | ||
|
||
if git diff --exit-code --quiet; then | ||
echo "No changes to the dependencies" | ||
exit 0 | ||
fi | ||
|
||
git checkout -b "$BRANCH_NAME" | ||
git add . | ||
|
||
git commit -F- <<EOF | ||
Update dependencies | ||
Updates from "rebar3 update-deps --replace": | ||
$_update_output | ||
EOF | ||
|
||
git push --set-upstream origin "$BRANCH_NAME" | ||
|
||
if [[ $(check_pr) == "" ]]; then | ||
gh pr create --fill --label "$GITHUB_PR_LABEL" | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Check Dependencies | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '38 8 * * *' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-deps: | ||
name: Check Dependencies | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
otp_version: ['27.1'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{ matrix.otp_version }} | ||
version-type: 'strict' | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/rebar3 | ||
_build | ||
key: ${{ runner.os }}-erlang-${{ matrix.otp_version }}-${{ hashFiles('**/*rebar.lock') }} | ||
|
||
- name: Build | ||
run: make build | ||
|
||
- name: Check dependencies | ||
run: .github/workflows/check-deps.sh | ||
env: | ||
BRANCH_NAME: update-deps-${{ github.run_id }} |