Use pytorchbot token #14
Workflow file for this run
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: Propose to merge ghstack orig PRs to main | |
on: | |
pull_request: | |
types: [opened, synchronize, closed] | |
branches: | |
- 'gh/*/[0-9]+/base' | |
- 'kirklandsigntest/*' | |
jobs: | |
ghstack_merge_to_main: | |
name: ghstack-land | |
runs-on: ubuntu-22.04 | |
environment: cherry-pick-bot | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Try to merge PR to main | |
run: | | |
pip install ghstack | |
pip install pygithub | |
PR_NUMBER=$(echo "$GITHUB_REF" | grep -oE '[0-9]+') | |
echo "Checking whether PR $PR_NUMBER is merged" | |
PR_MERGED=$(python -c "from github import Github; g = Github(); repo = g.get_repo('pytorch/executorch'); pr = repo.get_pull(${PR_NUMBER}); print(1 if pr.merged else 0)") | |
if [ "$PR_MERGED" = "0" ]; then | |
echo $"PR $PR_NUMBER is not merged. No op here." | |
# exit 0 | |
fi | |
python .github/scripts/propose_ghstack_orig_pr.py --pr $PR_NUMBER --repo pytorch/executorch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }} | |
GITHUB_REF: ${{ github.ref }} |