Skip to content

Conversation

iaine
Copy link
Collaborator

@iaine iaine commented Jul 29, 2025

This PR has two files: call_jobs.yml that calls the reusable workflows and reuse-build-publish-amd.yml that creates a workflow to build an amd container. This is in response to part of issue #252 .

@hturner
Copy link
Member

hturner commented Jul 29, 2025

The reusable workflow reuse-build-publish-amd.yml is not intended to be triggered directly, so you should remove the push and pull_request triggers entirely (L35 -52).

Put the triggers instead in the calling workflow. In there, we can remove the push triggers, I added these temporarily when trouble-shooting the workflow earlier, to avoid opening lots of PRs. So instead of current L3-7, I think we want:

workflow_dispatch:
pull_request:
    branches:
      - main
      - devel
    types:
      - closed
    paths:
      - '.github/workflows/call_jobs.yml'
      - '.github/workflows/reuse-build-publish-amd.yml'
      - '.devcontainer/devcontainer.json'
      - 'Dockerfile'
      - 'VERSION'

As the the calling workflow is responsible for defining what triggers it, I think we can simplify things a lot by removing the if (L60-64) from the reusable workflow (which will reduce the number of inputs you need into the workflow).

Finally, we don't want to hard-code using the devel version of the reusuable workflow as this should also work on main (i.e., we should use the devel reusable workflow on the devel branch and the main reusuable workflow on the main branch). So on L14 we want:

uses: r-devel/r-dev-env/.github/workflows/reuse-build-and-publish.yml@${{ github.ref_name }}

@iaine
Copy link
Collaborator Author

iaine commented Jul 29, 2025

I've made most of those changes and it has built the container in testing.

The one thing that I am struggling with is the change uses: r-devel/r-dev-env/.github/workflows/reuse-build-and-publish.yml@${{ github.ref_name }}.

The discussion at https://github.com/orgs/community/discussions/45342 says that the uses keyword needs a literal name for the reference, sha, or version: You cannot use contexts or expressions in this keyword. (https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows?learn=getting_started#calling-a-reusable-workflow)

I have put in an if statement to check the branch to avoid having a reference to a local version of the workflow. This does mean that we need to have the workflows in main as well or the action fails.

@hturner
Copy link
Member

hturner commented Jul 29, 2025

Oh okay, that is a bit tricky.

But from this last comment: https://github.com/orgs/community/discussions/45342#discussioncomment-13416453, it seems we can skip the @ part altogether and use a relative path as we are calling a reusable workflow in the same repo. Worth trying!

@iaine
Copy link
Collaborator Author

iaine commented Jul 29, 2025

Oh, that will work. Just means that the workflow will not be limited to main or devel, but maybe that is not so much of an issue?

@hturner
Copy link
Member

hturner commented Jul 29, 2025

That shouldn't be an issue as we are already restricted the triggers to the main and devel branch.

@iaine
Copy link
Collaborator Author

iaine commented Jul 29, 2025

Okay. I'll crack on with the manifest part of #252. Just wanted to ensure I had not opened anything that ought not to be open.

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.

2 participants