Skip to content

Generate Downstream PRs (dry-run: true) #130

Generate Downstream PRs (dry-run: true)

Generate Downstream PRs (dry-run: true) #130

Workflow file for this run

---
name: Generate Downstream PRs
run-name: "Generate Downstream PRs (dry-run: ${{ inputs.dry-run }})"
on:
workflow_dispatch:
inputs:
message:
description: "Message to include in the generated commits:"
required: true
custom-pr-title:
description: "Optionally a custom PR title. If unset, default will be used"
dry-run:
description: "Dry Run (PRs are not generated)"
type: boolean
default: true
fail-fast:
description: "Fail fast (if one job fails, all other are cancelled)"
type: boolean
default: false
permissions: {}
jobs:
create-prs:
runs-on: ubuntu-latest
strategy:
fail-fast: ${{ inputs.fail-fast }}
matrix:
# This should be the list of repository names from config/repositories.yaml:
# yq '.repositories | map(.name)' config/repositories.yaml
repository:
- airflow-operator
- commons-operator
- druid-operator
- hbase-operator
- hdfs-operator
- hive-operator
- kafka-operator
- nifi-operator
- listener-operator
- opa-operator
- opensearch-operator
- secret-operator
- spark-k8s-operator
- superset-operator
- trino-operator
- zookeeper-operator
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: cachix/install-nix-action@17fe5fb4a23ad6cbbe47d6b3f359611ad276644c # v31.4.0
- name: Install Ansible
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt update && \
sudo apt install -y software-properties-common && \
sudo apt-add-repository ppa:ansible/ansible -y && \
sudo apt install -y ansible
# NOTE (@NickLarsenNZ): This could be removed in favor of nix-shell and rrbutani/use-nix-shell-action
- name: Install deps for operators
run: |
sudo apt-get install \
protobuf-compiler \
krb5-user \
libclang-dev \
libkrb5-dev \
liblzma-dev \
libssl-dev \
pkg-config
- name: Install jinja2
run: pip install -r requirements.txt
# Create commit message depending on whether this is run manually or due to a scheduled run
- name: Set commit message for manual dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
REASON: ${{ github.event.inputs.message }}
AUTHOR: ${{ github.event.sender.login }}
run: |
echo "AUTHOR=$AUTHOR" >> "$GITHUB_ENV"
echo "REASON=$REASON" >> "$GITHUB_ENV"
- name: Set commit message for schedule
if: ${{ github.event_name == 'schedule' }}
run: |
echo "AUTHOR=stackabletech/developers"
echo "REASON=Daily run triggered" >> "$GITHUB_ENV"
- name: Run playbook
env:
CUSTOM_PR_TITLE: ${{ inputs.custom-pr-title }}
GH_ACCESS_TOKEN: ${{ secrets.gh_access_token }}
REPOSITORY: ${{ matrix.repository }}
# tags local excludes all actions that actually generate PRs
DRY_RUN_FLAGS: ${{ inputs.dry-run && "--tags local" || "" }}

Check failure on line 100 in .github/workflows/generate_prs.yml

View workflow run for this annotation

GitHub Actions / Generate Downstream PRs

Invalid workflow file

The workflow is not valid. .github/workflows/generate_prs.yml (Line: 100, Col: 26): Unexpected symbol: '"--tags'. Located at position 19 within expression: inputs.dry-run && "--tags local" || ""
run: |
# Funnel via JSON to ensure that values are escaped properly
echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, author: $ENV.AUTHOR, reason: $ENV.REASON, custom_pr_title: $ENV.CUSTOM_PR_TITLE, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN, shard_repositories: [$ENV.REPOSITORY]} | with_entries(select(.value != null and .value != ""))' --arg pwd "$(pwd)" > vars.json
ansible-playbook playbook/playbook.yaml --extra-vars "@vars.json" $DRY_RUN_FLAGS