Skip to content

Commit

Permalink
fix(check_deps): update commit sha where to open new branch
Browse files Browse the repository at this point in the history
Closes #858
  • Loading branch information
Wabri committed Sep 10, 2024
1 parent c1b479e commit 22f2415
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/check_outdated_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ jobs:
with:
ref: "dev"

- name: Set ENV variable COMMIT_SHA
run: |
echo "COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Check workflow dependencies
uses: ./workflows/check_outdate_deps
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SHA: ${{ secrets.GITHUB_SHA }}
COMMIT_SHA: ${{ env.COMMIT_SHA }}
REQUIREMENT_FILE: "requirements-workflow.txt"
OPEN_PR: "True"
OPEN_PR_BASE: "dev"
7 changes: 4 additions & 3 deletions workflows/check_outdate_deps/check_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

TOKEN = str(os.environ.get("GITHUB_TOKEN"))
REPOSITORY = str(os.environ.get("GITHUB_REPOSITORY"))
COMMIT_SHA = str(os.environ.get("GITHUB_SHA"))
COMMIT_SHA = str(os.environ.get("COMMIT_SHA"))
REQUIREMENT_FILE = str(os.environ.get("REQUIREMENT_FILE"))
HEADERS = {
"Authorization": f"token {TOKEN}",
"Accept": "application/vnd.github+json"
"Accept": "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28"
}
OPEN_PR = os.environ.get("OPEN_PR")
OPEN_PR_BASE = os.environ.get("OPEN_PR_BASE")
Expand Down Expand Up @@ -156,7 +157,7 @@ def update_branch_with_changes(branch, file_to_change):
git config --global user.name "DependencyBot"
git fetch --prune
git stash push
git checkout -b {branch} origin/{branch}
git checkout {branch}
git stash pop
git checkout --theirs {REQUIREMENT_FILE}
git add {file_to_change}
Expand Down

0 comments on commit 22f2415

Please sign in to comment.