Skip to content

Update aiida-core requirement from ~=2.3.1 to ~=2.4.0 #246

Update aiida-core requirement from ~=2.3.1 to ~=2.4.0

Update aiida-core requirement from ~=2.3.1 to ~=2.4.0 #246

---
name: CI - Activate auto-merging for Dependabot PRs
on:
pull_request_target:
branches:
- ci/dependabot-updates
jobs:
update-dependabot-branch:
name: Update permanent dependabot branch
if: github.repository_owner == 'aiidateam' && startsWith(github.event.pull_request.head.ref, 'dependabot/') && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
env:
GIT_USER_NAME: The AiiDA Team
GIT_USER_EMAIL: [email protected]
steps:
- name: Setup git config
run: |
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_USER_EMAIL}"
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
persist-credentials: false
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install requests
while IFS="" read -r line || [ -n "${line}" ]; do
if [[ "${line}" =~ ^invoke.*$ ]]; then
invoke="${line}"
fi
done < requirements_dev.txt
pip install ${invoke}
- name: Run tasks for `optimade` and `aiida-core` dependencies
run: |
while IFS="" read -r line || [ -n "${line}" ]; do
if [[ "${line}" =~ ^aiida-core~=(.*)$ ]]; then
aiida_core="${BASH_REMATCH[1]}"
elif [[ "${line}" =~ ^optimade\[server\]~=(.*)$ ]]; then
optimade="${BASH_REMATCH[1]}"
fi
done < requirements.txt
invoke aiida-req --ver="${aiida_core}"
invoke optimade-req --ver="${optimade}"
git add requirements.txt .ci/aiida-version.json Dockerfile profiles/docker-compose*
git add requirements.txt README.md Dockerfile profiles/docker-compose*
if [ -n "$(git status --porcelain requirements.txt .ci/aiida-version.json Dockerfile README.md)" ]; then
# Only commit if there's something to commit (git will return non-zero otherwise)
echo "Committing update to hard-coded versions (AiiDA/OPTIMADE) !"
git commit -m "Update AiiDA/OPTIMADE"
echo "PUSH_BACK_TO_BRANCH=true" >> $GITHUB_ENV
else
echo "No changes to hard-coded versions (AiiDA/OPTIMADE)."
echo "PUSH_BACK_TO_BRANCH=false" >> $GITHUB_ENV
fi
- name: Update Dependabot branch
if: env.PUSH_BACK_TO_BRANCH == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.RELEASE_PAT }}
branch: ${{ github.event.pull_request.head.ref }}
- name: Activate auto-merge
run: |
PR_ID="$(gh api graphql -F owner='{owner}' -F name='{repo}' -f query='query($owner: String!, $name: String!) {repository(owner: $owner, name: $name) {pullRequest(number: ${{ github.event.pull_request.number }}) {id}}}' --jq '.data.repository.pullRequest.id')"
gh api graphql -f pr_id="$PR_ID" -f query='mutation($pr_id: ID!) {enablePullRequestAutoMerge(input:{mergeMethod:SQUASH,pullRequestId:$pr_id }) {pullRequest {number}}}'
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}