Update ComposerLockDiff workflow to run without DDEV and use a sticky pull request comment #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Composer Lock Diff" | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_call: | |
inputs: | |
pr-number: | |
required: true | |
type: string | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
Composer-Lock-Diff: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check if composer.lock was changed | |
id: composer-lock-changed | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: 'composer.lock' | |
- name: Delete sticky pull request comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: composer-lock-diff | |
number: ${{ inputs.pr-number || github.event.number }} | |
delete: true | |
- uses: actions/cache@v4 | |
if: ${{ steps.composer-lock-changed.outputs.any_changed == 'true' }} | |
with: | |
path: ${{ github.workspace }}/.ddev/.drainpipe-composer-cache | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Generate composer diff | |
if: ${{ steps.composer-lock-changed.outputs.any_changed == 'true' }} | |
id: composer-diff | |
uses: IonBazan/composer-diff-action@v1 | |
with: | |
base: ${{ github.base_ref || github.ref_name }} | |
with-platform: true | |
with-links: true | |
- name: Post sticky pull request comment | |
if: ${{ steps.composer-lock-changed.outputs.any_changed == 'true' }} | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: composer-lock-diff | |
number: ${{ inputs.pr-number || github.event.number }} | |
message: | | |
### Composer package changes | |
${{ (steps.composer-diff.outcome != 'success' && 'Review any changes to composer.lock manually.') || steps.composer-diff.outputs.composer_diff || 'No changes found' }} | |