diff --git a/.github/workflows/check_outdated_dependencies.yml b/.github/workflows/check_outdated_dependencies.yml index 519adbf5b..d5db3cb73 100644 --- a/.github/workflows/check_outdated_dependencies.yml +++ b/.github/workflows/check_outdated_dependencies.yml @@ -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" diff --git a/workflows/check_outdate_deps/check_deps.py b/workflows/check_outdate_deps/check_deps.py index dcbe4f0d2..c4ea2806e 100644 --- a/workflows/check_outdate_deps/check_deps.py +++ b/workflows/check_outdate_deps/check_deps.py @@ -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") @@ -155,13 +156,10 @@ def update_branch_with_changes(branch, file_to_change): git config --global user.email "dependencybot@linuxlab" git config --global user.name "DependencyBot" git fetch --prune -git stash push -git checkout -b {branch} origin/{branch} -git stash pop -git checkout --theirs {REQUIREMENT_FILE} -git add {file_to_change} +git checkout -b {branch} +git add --all git commit --message=\"Update {file_to_change} on `date`\" -git push +git push --set-upstream origin {branch} """)