add a workflow to checkout a branch of a repo. #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check out a branch of an external repo. | |
on: | |
workflow_call: | |
inputs: | |
repository: | |
description: The repo to check out. | |
required: true | |
default: "@collaborators/push" | |
type: string | |
branch: | |
description: The branch to check out. | |
required: true | |
default: "@collaborators/push" | |
type: string | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
deployments: write # to delete deployments | |
pull-requests: write # to remove labels | |
statuses: write # to create commit status | |
outputs: | |
PULLPREVIEW_URL: ${{ steps.pullpreview.outputs.url }} | |
PULLPREVIEW_HOST: ${{ steps.pullpreview.outputs.host }} | |
PULLPREVIEW_USERNAME: ${{ steps.pullpreview.outputs.username }} | |
steps: | |
- name: Checkout GitHub repository | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'differ') && github.event.action != 'unlabeled' && github.event.action != 'closed' }} | |
# https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: "${{ inputs.repository }}" | |
ref: "${{ inputs.branch }}" | |
run: | | |
git checkout -b "${{ inputs.branch }}" | |
git commit "inital commit" | |
git push |