Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update related jobs
  • Loading branch information
abikouo authored and Qalthos committed Apr 5, 2023
commit ee1532279e23c0c3a85940a05345102a40fbd592
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Checkout_repository
# checkout_dependency

This action checks-out your repository under the specified destination directory using the action actions/checkout. Use the `depends-On: repository/pull/xx` to override the reference to checkout.

Expand All @@ -7,7 +7,7 @@ This action checks-out your repository under the specified destination directory
<!-- start usage -->

```yaml
- uses: ansible-network/github_actions/.github/actions/checkout_repository@main
- uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
with:
# Repository name with owner. For example, ansible-collections/kubernetes.core
repository: ""
Expand All @@ -18,6 +18,9 @@ This action checks-out your repository under the specified destination directory

# Relative path under $GITHUB_WORKSPACE to place the repository
path: ""

# Number of commits to fetch. 0 indicates all history for all branches and tags.
fetch-depth: "1"
```

<!-- end usage -->
Expand All @@ -39,7 +42,7 @@ Depends-On: repository/pull/xx
Github action step:

```yaml
- uses: ansible-network/github_actions/.github/actions/checkout_repository@main
- uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
with:
repository: my_org/my_collection
ref: main
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
name: "Checkout Repository"
name: "Checkout Dependency"
description: |
checkout repository and override commit based on keyword 'depends-on' from pull request message
inputs:
repository:
description: |
Repository to checkout, repository is defined by organisation and repository name
e.g: ansible-collections/kubernetes.core
description: "Repository name with owner. For example, ansible-collections/cloud.common"
required: true
ref:
description: |
The default branch, tag or SHA to checkout.
required: true
description: "The default branch, tag or SHA to checkout if no reference (using depends-on) is found"
path:
description: |
Path where repositories will be checkout
required: true
description: "Relative path under $GITHUB_WORKSPACE to place the repository"
fetch-depth:
description: "Number of commits to fetch. 0 indicates all history for all branches and tags."
default: "1"
runs:
using: composite
steps:
Expand All @@ -28,22 +25,24 @@ runs:
pip install -U PyGithub
shell: bash

- id: dependency-resolution
- id: resolve-dependency
shell: bash
run: |
python ${{ github.action_path }}/resolve_dependency.py
env:
RESOLVE_REF_PR_BODY: ${{ github.event.pull_request.body }}
RESOLVE_REF_REPOSITORY: ${{ inputs.repository }}

- name: display merge commit sha from dependency resolution
run: echo "[checkout ${{ inputs.repository }}] merge commit sha from dependency resolution => '${{ steps.dependency-resolution.outputs.merge_commit_sha }}'"
- name: Display reference to checkout
run: echo "Resolved reference -> '${RESOLVED_REF}'"
shell: bash
env:
RESOLVED_REF: ${{ steps.resolve-dependency.outputs.merge_commit_sha }}

- name: checkout repository
uses: actions/checkout@v3
with:
repository: ${{ inputs.repository }}
path: ${{ inputs.path }}
ref: ${{ steps.dependency-resolution.outputs.merge_commit_sha || inputs.ref }}
fetch-depth: "0"
ref: ${{ steps.resolve-dependency.outputs.merge_commit_sha || inputs.ref }}
fetch-depth: ${{ inputs.fetch-depth }}
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:

- name: Checkout ${{ steps.identify.outputs.dependency }}
if: steps.identify.outputs.dependency != '' && matrix.dependency-source == 'github'
uses: actions/checkout@v3
uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
with:
repository: ansible-collections/${{ steps.identify.outputs.dependency }}
path: ${{ env.dependency_directory }}
Expand Down