./github/workflows/add-label-when-promoted.yaml: Run auto-backport on… #1
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: Check if commits are promoted | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- next-*.* | ||
pull_request_target: | ||
types: [labeled] | ||
branches: [master, next] | ||
env: | ||
DEFAULT_BRANCH: ${{ github.repository == 'scylladb/scylla-enterprise' && 'enterprise' || 'master' }} | ||
jobs: | ||
check-commit: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
issues: write | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.repository }} | ||
ref: ${{ env.DEFAULT_BRANCH }} | ||
token: ${{ secrets.AUTO_BACKPORT_TOKEN }} | ||
fetch-depth: 0 # Fetch all history for all tags and branches | ||
<<<<<<< HEAD | ||
||||||| parent of 26ef84f (./github/workflows/add-label-when-promoted.yaml: Run auto-backport only on default branch) | ||
- name: Set up Git identity | ||
run: | | ||
git config --global user.name "GitHub Action" | ||
git config --global user.email "[email protected]" | ||
======= | ||
- name: Set up Git identity | ||
run: | | ||
git config --global user.name "GitHub Action" | ||
git config --global user.email "[email protected]" | ||
git config --global merge.conflictstyle diff3 | ||
>>>>>>> 26ef84f (./github/workflows/add-label-when-promoted.yaml: Run auto-backport only on default branch) | ||
- name: Install dependencies | ||
run: sudo apt-get install -y python3-github python3-git | ||
- name: Run python script | ||
if: github.event_name == 'push' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.AUTO_BACKPORT_TOKEN }} | ||
run: python .github/scripts/search_commits.py --commits ${{ github.event.before }}..${{ github.sha }} --repository ${{ github.repository }} --ref ${{ github.ref }} | ||
<<<<<<< HEAD | ||
- name: Run auto-backport.py whe promotion completed | ||
if: github.event_name == 'push' | ||
||||||| parent of 26ef84f (./github/workflows/add-label-when-promoted.yaml: Run auto-backport only on default branch) | ||
- name: Run auto-backport.py when promotion completed | ||
if: github.event_name == 'push' | ||
======= | ||
- name: Run auto-backport.py when promotion completed | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/${{ env.DEFAULT_BRANCH }}' | ||
>>>>>>> 26ef84f (./github/workflows/add-label-when-promoted.yaml: Run auto-backport only on default branch) | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.AUTO_BACKPORT_TOKEN }} | ||
run: python .github/scripts/auto-backport.py --repo ${{ github.repository }} --base-branch ${{ github.ref }} --commits ${{ github.event.before }}..${{ github.sha }} | ||
- name: Run auto-backport.py when label was added | ||
if: github.event_name == 'pull_request_target' && startsWith(github.event.label.name, 'backport/') && (github.event.pull_request.state == 'closed' && github.event.pull_request.merged == true) | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.AUTO_BACKPORT_TOKEN }} | ||
run: python .github/scripts/auto-backport.py --repo ${{ github.repository }} --base-branch ${{ github.ref }} --pull-request ${{ github.event.pull_request.number }} --commits ${{ github.sha }} |