Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 11 additions & 3 deletions .github/workflows/generate_prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
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
Expand Down Expand Up @@ -155,12 +157,18 @@ jobs:
# Generate PRs
- name: Run playbook
if: ${{ !inputs.dry-run }}
env:
CUSTOM_PR_TITLE: ${{ inputs.custom-pr-title }}
GH_ACCESS_TOKEN: ${{ secrets.gh_access_token }}
run: |
# Funnel via JSON to ensure that values are escaped properly
echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, author: $ENV.AUTHOR, reason: $ENV.REASON, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN}' --arg pwd "$(pwd)" > vars.json
# Check if custom PR title is set. If so, insert it into the extra vars
if [ -n "$CUSTOM_PR_TITLE" ]; then
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}' --arg pwd "$(pwd)" > vars.json
else
echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, author: $ENV.AUTHOR, reason: $ENV.REASON, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN}' --arg pwd "$(pwd)" > vars.json
fi
ansible-playbook playbook/playbook.yaml --extra-vars "@vars.json"
env:
GH_ACCESS_TOKEN: ${{ secrets.gh_access_token }}

# Do Not Generate PRs
- name: Run playbook (dry-run)
Expand Down
2 changes: 1 addition & 1 deletion playbook/group_vars/all/vars
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ commit_message: |
Reference-to: stackabletech/operator-templating@{{ commit_short_hash }} ({{ reason }})

# Title and body of created PRs
pr_title: "chore: Update templated files ({{ commit_short_hash }})"
pr_title: "{{ custom_pr_title | default('chore: Update templated files (' + commit_short_hash + ')') }}"
pr_body: |
> [!NOTE]
> _Autogenerated PR to update templated files since the last template run up to stackabletech/operator-templating@{{ commit_hash }}._
Expand Down