Merge pull request #293 from webknjaz/bugfixes/uncheckout-intermediate-action
This commit is contained in:
commit
0a87186d5f
22
action.yml
22
action.yml
|
@ -130,24 +130,28 @@ runs:
|
||||||
PR_REF: ${{ github.event.pull_request.head.ref }}
|
PR_REF: ${{ github.event.pull_request.head.ref }}
|
||||||
PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
|
PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
|
||||||
PR_REPO_ID: ${{ github.event.pull_request.base.repo.id }}
|
PR_REPO_ID: ${{ github.event.pull_request.base.repo.id }}
|
||||||
- name: Check out action repo
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
path: action-repo
|
|
||||||
ref: ${{ steps.set-repo-and-ref.outputs.ref }}
|
|
||||||
repository: ${{ steps.set-repo-and-ref.outputs.repo }}
|
|
||||||
- name: Create Docker container action
|
- name: Create Docker container action
|
||||||
run: |
|
run: |
|
||||||
# Create Docker container action
|
# Create Docker container action
|
||||||
python create-docker-action.py
|
python ${{ github.action_path }}/create-docker-action.py
|
||||||
env:
|
env:
|
||||||
REF: ${{ steps.set-repo-and-ref.outputs.ref }}
|
REF: ${{ steps.set-repo-and-ref.outputs.ref }}
|
||||||
REPO: ${{ steps.set-repo-and-ref.outputs.repo }}
|
REPO: ${{ steps.set-repo-and-ref.outputs.repo }}
|
||||||
REPO_ID: ${{ steps.set-repo-and-ref.outputs.repo-id }}
|
REPO_ID: ${{ steps.set-repo-and-ref.outputs.repo-id }}
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: action-repo
|
|
||||||
- name: Run Docker container
|
- name: Run Docker container
|
||||||
uses: ./action-repo/.github/actions/run-docker-container
|
# The generated trampoline action must exist in the allowlisted
|
||||||
|
# runner-defined working directory so it can be referenced by the
|
||||||
|
# relative path starting with `./`.
|
||||||
|
#
|
||||||
|
# This mutates the end-user's workspace slightly but uses a path
|
||||||
|
# that is unlikely to clash with somebody else's use.
|
||||||
|
#
|
||||||
|
# We cannot use randomized paths because the composite action
|
||||||
|
# syntax does not allow accessing variables in `uses:`. This
|
||||||
|
# means that we end up having to hardcode this path both here and
|
||||||
|
# in `create-docker-action.py`.
|
||||||
|
uses: ./.github/.tmp/.generated-actions/run-pypi-publish-in-docker-container
|
||||||
with:
|
with:
|
||||||
user: ${{ inputs.user }}
|
user: ${{ inputs.user }}
|
||||||
password: ${{ inputs.password }}
|
password: ${{ inputs.password }}
|
||||||
|
|
|
@ -10,10 +10,12 @@ REPO = os.environ['REPO']
|
||||||
REPO_ID = os.environ['REPO_ID']
|
REPO_ID = os.environ['REPO_ID']
|
||||||
REPO_ID_GH_ACTION = '178055147'
|
REPO_ID_GH_ACTION = '178055147'
|
||||||
|
|
||||||
|
ACTION_SHELL_CHECKOUT_PATH = pathlib.Path(__file__).parent.resolve()
|
||||||
|
|
||||||
|
|
||||||
def set_image(ref: str, repo: str, repo_id: str) -> str:
|
def set_image(ref: str, repo: str, repo_id: str) -> str:
|
||||||
if repo_id == REPO_ID_GH_ACTION:
|
if repo_id == REPO_ID_GH_ACTION:
|
||||||
return '../../../Dockerfile'
|
return str(ACTION_SHELL_CHECKOUT_PATH / 'Dockerfile')
|
||||||
docker_ref = ref.replace('/', '-')
|
docker_ref = ref.replace('/', '-')
|
||||||
return f'docker://ghcr.io/{repo}:{docker_ref}'
|
return f'docker://ghcr.io/{repo}:{docker_ref}'
|
||||||
|
|
||||||
|
@ -70,6 +72,20 @@ action = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
action_path = pathlib.Path('.github/actions/run-docker-container/action.yml')
|
# The generated trampoline action must exist in the allowlisted
|
||||||
|
# runner-defined working directory so it can be referenced by the
|
||||||
|
# relative path starting with `./`.
|
||||||
|
#
|
||||||
|
# This mutates the end-user's workspace slightly but uses a path
|
||||||
|
# that is unlikely to clash with somebody else's use.
|
||||||
|
#
|
||||||
|
# We cannot use randomized paths because the composite action
|
||||||
|
# syntax does not allow accessing variables in `uses:`. This
|
||||||
|
# means that we end up having to hardcode this path both here and
|
||||||
|
# in `action.yml`.
|
||||||
|
action_path = pathlib.Path(
|
||||||
|
'.github/.tmp/.generated-actions/'
|
||||||
|
'run-pypi-publish-in-docker-container/action.yml',
|
||||||
|
)
|
||||||
action_path.parent.mkdir(parents=True, exist_ok=True)
|
action_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
action_path.write_text(json.dumps(action, ensure_ascii=False), encoding='utf-8')
|
action_path.write_text(json.dumps(action, ensure_ascii=False), encoding='utf-8')
|
||||||
|
|
Loading…
Reference in New Issue