Skip to content

[help] trying to make it work on a scheduled composer update #9

@patrick-leb

Description

@patrick-leb

hi there!

You action works perfectly on my PR workflow, no problem there.
I'd like to commit a composer update on a schedule. here is my workflow:

'on':
  schedule:
    -
      cron: '24 6 * * 1,2,3,4,5'
  workflow_dispatch: null
jobs:
  composer_update_job:
    runs-on: ubuntu-latest
    name: 'composer update'
    steps:
    
      - name: Get current date
        id: date
        run: echo "::set-output name=date::$(date +'%Y-%m-%d')" 
      -
        name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      -
        name: 'Setup PHP'
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.0'
      -
        name: 'Run composer update'
        run: 'composer update --no-dev --no-progress'
        id: run_composer
        
      - name: Generate composer diff
        id: composer_diff # To reference the output in comment
        uses: IonBazan/composer-diff-action@v1
        with: 
          no-dev: true
          format: mdlist
      -
        name: 'Create Pull Request'
        uses: peter-evans/create-pull-request@v4
        id: cpr
        with:
          token: '${{ secrets.MERGE_TOKEN }}'
          commit-message: ${{ steps.composer_diff.outputs.composer_diff }}
          committer: 'Woogo Bot <noreply@github.com>'
          author: 'Woogo Bot <woogo.bot@users.noreply.github.com>'
          branch: woogobot/composer-update
          delete-branch: true
          title: 'feat(plugins) composer update'
          labels: 'composer update'

The output of ${{ steps.composer_diff.outputs.composer_diff }} is empty there. However in the PR check, it will be correct.

What am I doing wrong here ?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions