Skip to content

Commit

Permalink
Merge pull request #95 from rhobs/konflux_update
Browse files Browse the repository at this point in the history
konflux update workflow
  • Loading branch information
coleenquadros authored Aug 12, 2024
2 parents 2a47fb8 + 3a035f5 commit e1d4216
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/acm-konflux-update-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Check Konflux PRs in Downstream Repos

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1' #@weekly
pull_request:
paths:
- '.github/workflows/acm-konflux-update-pr.yaml'
push:
paths:
- '.github/workflows/acm-konflux-update-pr.yaml'

jobs:
check-konflux-prs:
runs-on: ubuntu-latest
strategy:
matrix:
repo:
- stolostron/thanos
- stolostron/node-exporter
- stolostron/kube-state-metrics
- stolostron/prometheus
- stolostron/prometheus-alertmanager
- stolostron/prometheus-operator
- stolostron/grafana
- stolostron/kube-rbac-proxy
- stolostron/multicluster-observability-operator
- stolostron/observatorium
- stolostron/observatorium-operator
- stolostron/thanos-receive-controller
- stolostron/kube-thanos

steps:
- name: Checkout upstream
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
fetch-depth: 0
- name: Find github org name from repo name
id: org
run: |
echo "downstream=$(dirname ${{ matrix.repo }})" >> $GITHUB_OUTPUT
- name: Get auth token to list pull request for ${{ matrix.repo }}
if: github.event_name != 'pull_request'
id: pr
uses: getsentry/action-github-app-token@v3
with:
app_id: ${{ secrets.ACM_APP_ID }}
private_key: ${{ secrets.ACM_APP_PRIVATE_KEY }}
scope: ${{ steps.org.outputs.downstream }}
- name: List PRs and check for Konflux
id: check-prs
if: github.event_name != 'pull_request'
run: |
PR_LIST=$(gh pr list --repo ${{ matrix.repo }} --state open --json title)
KONFLUX_PR=$(echo "$PR_LIST" | jq '.[] | select(.title | ascii_downcase | contains("konflux"))')
if [ -n "$KONFLUX_PR" ]; then
echo "konflux_pr_exists=1" >> $GITHUB_OUTPUT
else
echo "konflux_pr_exists=0" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ steps.pr.outputs.token }}
- name: Compose Slack message
id: slack-message
run: |
if [ "${{ steps.check-prs.outputs.konflux_pr_exists }}" == "1" ]; then
echo "message=Unmerged Konflux PRs are present in https://github.com/${{ matrix.repo }}" >> $GITHUB_OUTPUT
fi
- name: Send Slack notification
uses: 8398a7/action-slack@v3
if : ${{ steps.check-prs.outputs.konflux_pr_exists == '1' }}
with:
status: custom
fields: workflow
custom_payload: |
{
attachments: [{
color: 'danger',
text: "${{ steps.slack-message.outputs.message }}",
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACM_SLACK_WEBHOOK_URL }}

0 comments on commit e1d4216

Please sign in to comment.