Skip to content

Auto pr#23

Open
dhidalgX wants to merge 3 commits intomainfrom
auto-pr
Open

Auto pr#23
dhidalgX wants to merge 3 commits intomainfrom
auto-pr

Conversation

@dhidalgX
Copy link

Adding a reusable action for Automating PR creation, needed when fluxcd triggers a image automation.
I think this PR can wait until Joshua is back.

@dhidalgX dhidalgX requested review from a team and joshuasing as code owners May 15, 2025 16:06
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
echo "Detected branch: $BRANCH_NAME"

IFS=' ' read -r -a allowed <<< "${{ inputs.allowed-branches }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is space-separated ideal here? I think comma-separated could be more consistent (e.g. with reviewers):

Suggested change
IFS=' ' read -r -a allowed <<< "${{ inputs.allowed-branches }}"
IFS=',' read -r -a allowed <<< "${{ inputs.allowed-branches }}"

using: "composite"
steps:
- name: Check if branch is allowed and create PR
run: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ${{ }} syntax within run is dangerous -- as it is replaced before the script is executed, and allows script injection.

Instead, it is best to use environment variables to pass in the variables, e.g.

      env:
        ALLOWED_BRANCHES: "${{ inputs.allowed-branches }}"
      run: |
        echo "$ALLOWED_BRANCHES"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants