Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safeguard backport workflow #10828

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/backport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check if PR has a label containing the word backport, exit if not
run: |
LABELS=$(jq -r '.pull_request.labels[].name' "$GITHUB_EVENT_PATH")
echo "$LABELS" | grep -iq "backport" || exit 0

- name: Check if PR comes from a fork, comment and exit if that's the case
run: |
IS_FORK=$(jq -r '.pull_request.head.repo.fork' "$GITHUB_EVENT_PATH")
if [[ "$IS_FORK" == "true" ]]; then
COMMENT=":warning: This PR comes from a fork and cannot be backported automatically. Please ask a Mimir maintainer for assistance."
gh pr comment "${{ github.repository }}#${{ github.event.pull_request.number }}" --body "$COMMENT"
exit 0
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Retrieve GitHub App credentials from Vault
id: get-secrets
uses: grafana/shared-workflows/actions/[email protected]
Expand Down
Loading