Skip to content

Commit

Permalink
feat: Improve composer autoupdate behaviour (#74)
Browse files Browse the repository at this point in the history
* chore: update index.js to update based on repo name *-bedrock private using organization repo with github api

* feat: update index.js to list all bedrocks and trigger workflow to all define branches
feat: update index.js to send workflow with the desired package instead of all pressbooks packages
feat: update auto-update.yml to accept input package and prevent concurrent runs when updating multiple packages
feat: add test folder to run index.js locally

* chore: update dev branches to use test branch of bedrock

* chore: add check to see if the repo is in composer.json before dispatching

* chore: add checks to ensure the bedrock has the branch and repo before triggering action

* chore: build code

* chore: add fetch to support lower node version

* fix: dispatch using repo name and not the entire object

* chore: clean up code

* chore: remove testing bedrock trigger only case

* chore: update readme.md instruction for usage and release
chore: update console log message when dispatching workflow with more clarity
  • Loading branch information
ho-man-chan committed Feb 29, 2024
1 parent b9aea1e commit 7ac1f5a
Show file tree
Hide file tree
Showing 9 changed files with 4,534 additions and 220 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/auto-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ name: Pressbooks composer updater

on:
workflow_call:
inputs:
package:
required: true
type: string


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
composer_update_job:
Expand Down Expand Up @@ -30,4 +38,4 @@ jobs:
GIT_EMAIL: ops@pressbooks.com
APP_SINGLE_BRANCH: 1
GIT_COMMIT_PREFIX: 'chore: '
COMPOSER_PACKAGES: 'pressbooks/*'
COMPOSER_PACKAGES: ${{github.event.inputs.package}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ vendor/*
web/*
auth.json
node_modules/*
run.sh
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ on:

jobs:
composer_update_job:
uses: pressbooks/composer-autoupdate-bedrock/.github/workflows/auto-update.yml@v1
uses: pressbooks/composer-autoupdate-bedrock/.github/workflows/auto-update.yml@main
secrets: inherit
```

Expand All @@ -45,7 +45,7 @@ on:

jobs:
automerge:
uses: pressbooks/composer-autoupdate-bedrock/.github/workflows/auto-merge.yml@v1
uses: pressbooks/composer-autoupdate-bedrock/.github/workflows/auto-merge.yml@main
secrets: inherit
```

Expand All @@ -67,7 +67,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Trigger Bedrock Composer Update
uses: pressbooks/composer-autoupdate-bedrock@v1
uses: pressbooks/composer-autoupdate-bedrock@main
with:
triggered-by: ${{ github.repository }}
token: ${{ secrets.ORGANIZATION_PAT }}
Expand Down Expand Up @@ -99,3 +99,9 @@ git push --follow-tags
```yaml
uses: pressbooks/composer-autoupdate-bedrock@vX
```

or if always using the latest version

```yaml
uses: pressbooks/composer-autoupdate-bedrock@main
```
Loading

0 comments on commit 7ac1f5a

Please sign in to comment.