From 3e57a9f07aa58f119d12849d0286d562ed407198 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 14 Jul 2025 14:46:34 -0400 Subject: [PATCH] Add action to modify external GitHub repo Signed-off-by: mulhern --- github-modify/action.yml | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 github-modify/action.yml diff --git a/github-modify/action.yml b/github-modify/action.yml new file mode 100644 index 0000000..f9a08be --- /dev/null +++ b/github-modify/action.yml @@ -0,0 +1,48 @@ +--- +# yamllint disable rule:line-length +name: 'Modify external repo to checkout from' +description: "Modify external repo to check out from" +inputs: + repo: + description: "The name of the GitHub repo" + required: true + type: string +runs: + using: "composite" + steps: + - name: Check out jbaublitz/${{ inputs.repo }} + if: github.event_name == 'pull_request' + id: jbaublitz + continue-on-error: true + uses: actions/checkout@v4 + with: + repository: jbaublitz/${{ inputs.repo }} + path: jbaublitz + ref: ${{ github.head_ref }} + - name: Check out mulkieran/${{ inputs.repo }} + if: github.event_name == 'pull_request' + id: mulkieran + continue-on-error: true + uses: actions/checkout@v4 + with: + repository: mulkieran/${{ inputs.repo }} + path: mulkieran + ref: ${{ github.head_ref }} + - name: Check if both checkouts succeeded + if: github.event_name == 'pull_request' && steps.jbaublitz.outcome == 'success' && steps.mulkieran.outcome == 'success' + run: | + echo "Branch conflict!" + exit 1 + - name: Conditionally make jbaublitz checkout branch the chosen one + if: github.event_name == 'pull_request' && steps.jbaublitz.outcome == 'success' + run: mv jbaublitz ${{ inputs.repo }} + - name: Conditionally make mulkieran checkout branch the chosen one + if: github.event_name == 'pull_request' && steps.mulkieran.outcome == 'success' + run: mv mulkieran ${{ inputs.repo }} + - name: Check out stratis-storage repo if no alternative branch was checked out + if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && steps.mulkieran.outcome == 'failure' && steps.jbaublitz.outcome == 'failure') + uses: actions/checkout@v4 + with: + repository: stratis-storage/${{ inputs.repo }} + path: ${{ inputs.repo }} + ref: master