Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Reusable GitHub Actions workflow #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ayesh
Copy link
Member

@Ayesh Ayesh commented Mar 3, 2025

Adds a new reusable.yml GitHub Actions workflow, that can be reused by the doc-base repo and individual php/doc-* repos.

The new reusable workflow accepts inputs that control the repos it checks out, the name of the language, and other tasks that the integration.yaml file previously did.

The new build.yml file then uses the reusable.yml workflow by passing parameters to run the same list of existing language builds.

The advantage of this is that doc-base acts as the baseline GitHub Actions repo, and updates to it (such as changing the runs-on value, updating uses values for other actions such as actions/checkout, and other chores only need to be done on the doc-base, and not on every php/doc-* repo.

Individual php/doc-* repos need to be updated to make use of the new reusable workflows, e.g.:

name: "Build Ukrainian language documentation"

on:
  push:
  pull_request:
    branches: "master"
  workflow_dispatch:

jobs:
  build:
    uses: php/doc-base/.github/workflows/reusable.yml@master
    with:
      language: 'uk'

@sy-records
Copy link
Member

It's a good idea, but the reusable.yml name should be changed 🤔

@Ayesh
Copy link
Member Author

Ayesh commented Mar 4, 2025

@sy-records yeah that name was on the top of my head... Got ideas?

Adds a new `reusable.yml` GitHub Actions workflow, that can be reused
by the `doc-base` repo and individual `php/doc-*` repos.

The new reusable workflow accepts inputs that control the repos it
checks out, the name of the language, and other tasks that the
`integration.yaml` file previously did.

The new `build.yml` file then uses the `reusable.yml` workflow by
passing parameters to run the same list of existing language builds.

The advantage of this is that `doc-base` acts as the baseline GitHub
Actions repo, and updates to it (such as changing the `runs-on` value,
updating `uses` values for other actions such as `actions/checkout`,
and other chores only need to be done on the `doc-base`, and not on
every `php/doc-*` repo.

Individual `php/doc-*` repos need to be updated to make use of the new
reusable workflows, e.g.:

```yml
name: "Build Ukrainian language documentation"

on:
  push:
  pull_request:
    branches: "master"
  workflow_dispatch:

jobs:
  build:
    uses: php/doc-base/.github/workflows/build-reusable.yml@master
    with:
      language: 'uk'
```
@Ayesh Ayesh force-pushed the reusable-build-workflows branch from 68d7858 to f9df1ba Compare March 4, 2025 16:19
@Ayesh
Copy link
Member Author

Ayesh commented Mar 4, 2025

I changed the name from reusable.yml to build-reusable.yml.

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