Skip to content

Refactor of JSON structure in response of get_by_code #240

Refactor of JSON structure in response of get_by_code

Refactor of JSON structure in response of get_by_code #240

name: Generate constraint file on comment
on:
issue_comment:
types: [created]
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_ORGANIZATION: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
jobs:
check-comment:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/update_constraints')
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- name: "Add reaction to comment"
uses: actions/github-script@v7
with:
script: |
console.log(context)
console.log(context.payload)
github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '+1',
});
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout Pull Request"
run: gh pr checkout "${ISSUE_NUMBER}"
- name: "Login to Githhub Container Registry"
run: ./scripts/docker_login_github.py
- name: "Copy .env.example to .env"
run: cp .env.example .env
- name: "Build CI image"
run: |
./scripts/ci-docker-image/build_image.sh
- name: "Generate constraint file"
run: >
docker compose run --no-deps --entrypoint /bin/bash web -c "pip freeze" |
grep -v -i "Django==" > ./dependencies/constraints-ci.txt
- name: "Setup Python dependencies"
run: pip install -U pip wheel setuptools virtualenv pre-commit
- name: "Run static checks"
run: pre-commit run requirements-txt-fixer --all-files --color=always
- name: "Commit and push"
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add ./dependencies/constraints-ci.txt
git commit -m "Update constraints file"
git push origin
- name: "Create a comment in PR"
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: '@Mergifyio rebase'