Bump tqdm from 4.64.1 to 4.66.2 #164
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
name: 'Pull Request Labeler' | |
on: | |
pull_request_target: | |
types: [opened, synchronize, reopened, edited] | |
permissions: {} | |
jobs: | |
pr-labeler: | |
permissions: | |
repository-projects: read | |
contents: read # to read a configuration file | |
pull-requests: write # to add labels to pull requests | |
runs-on: cdorunner-aipro-cicd | |
steps: | |
- name: Checkout ${{ github.event.client_payload.pull_request.head.ref }} | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.client_payload.pull_request.head.ref }} | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.7' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyyaml | |
- name: Update PR context | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR: ${{ github.event.pull_request.html_url }} | |
run: | | |
gh pr view $PR --json title,labels > check_pr.json | |
OLD_TITLE_PR=$(cat check_pr.json | jq '.title') | |
export OLD_TITLE_PR=${OLD_TITLE_PR:1:-1} | |
export NEW_TITLE_PR=$(python -c "import re; import os; title_pr = os.environ['OLD_TITLE_PR'].lstrip().rstrip(); match_standar_title=(re.match(r'^\[[a-zA-Z]+\]', title_pr)); print(*[match_standar_title.group().lower(), title_pr[len(match_standar_title.group()):]] if match_standar_title is not None else title_pr, sep='')") | |
export NEW_LABEL_PR=$(python -c "import re; import os; import yaml; from yaml.loader import SafeLoader; data = yaml.load(open('.github/pr-prefix-labeler.yml'), Loader=SafeLoader); title_pr = os.environ['NEW_TITLE_PR']; match_standar_title=(re.match(r'^\[[a-zA-Z]+\]', title_pr)); print(data.get(match_standar_title.group(), '') if match_standar_title is not None else '')") | |
NEW_LABEL_EXIST=$(python -c "import os; import json; data = json.load(open('check_pr.json')); exits = filter(lambda e: e['name'] == os.environ['NEW_LABEL_PR'], data['labels']); print(','.join([e['name'] for e in exits]))") | |
if [ "$OLD_TITLE_PR" != "$NEW_TITLE_PR" ] || [ $NEW_LABEL_PR != $NEW_LABEL_EXIST ]; then | |
gh pr edit $PR --title "${NEW_TITLE_PR}" --add-label "$NEW_LABEL_PR" | |
fi |