Giter Site home page Giter Site logo

ionbazan / composer-diff-action Goto Github PK

View Code? Open in Web Editor NEW
13.0 1.0 3.0 47 KB

Compare composer.lock files and generate human-readable list of package changes

License: MIT License

Dockerfile 52.02% Shell 47.98%
github markdown php diff composer packagist packages pullrequest composer-plugin composer-diff

composer-diff-action's Introduction

Hi there, I'm Ion Bazan πŸ‘‹πŸ»πŸ‘¨πŸ»β€πŸ’»

/iˈon bΙ™Λˆzɑːn/

I'm a Full Stack Software Developer born in Moldova πŸ‡²πŸ‡©, raised in Poland πŸ‡΅πŸ‡± and based in Singapore πŸ‡ΈπŸ‡¬, who is passionate about good practices πŸ“–, clean code 🧹, containerized environments πŸ‹ and good pizza πŸ•.

curl -L bazan.dev
  • 🏒 I am currently working as Tech Lead at Aspire
  • πŸ‘¨β€πŸ’» Maintaining Doctrine MongoDB ODM and multiple Open Source projects
  • πŸ“š I have over 6 years of professional experience
  • βš™οΈ I specialise in: PHP, React, JavaScript, Docker, MySQL, PostgreSQL, Symfony, Serverless
  • πŸ’¬ Ping me about DDD, SOLID, Symfony, Doctrine, Laravel
  • 🌱 Learning all about Open Source and Clean Architecture
  • 🌏 I speak Polish, Russian and English (including Singlish πŸ˜‰)
  • πŸ“« Reach me: Gmail Badge Linkedin Badge Messenger GitHub
  • πŸ“‡ Check out my visit card using curl -L bazan.dev
  • ❓ Ask me questions on my public AMA

composer-diff-action's People

Contributors

ionbazan avatar noresponsemate avatar t2l avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

composer-diff-action's Issues

composer_diff_exit_code value is always 0

I just started using this action but it never posts a comment, even when there is output in the diff (because the exit code is 0). I think the issue is that the README is newer than the most recent release so the code that runs in the action doesn't match the posted docs. The needed PR is #5

It stopped to work

Got error message today:

In PackageDiff.php line 135:

  Could not open file ad66625dce6fd04da4b628f870a7230cce53fd10:apps/silverbac  
  k-drupal/composer.lock or find it in git as ad66625dce6fd04da4b628f870a7230  
  cce53fd10:apps/silverback-drupal/composer.lock 

I tried to debug it by adding a new job step:

git show ad66625dce6fd04da4b628f870a7230cce53fd10:apps/silverback-drupal/composer.lock

This one worked without any issues.

Debugging here: AmazeeLabs/silverback-mono#1021

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

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 <[email protected]>'
          author: 'Woogo Bot <[email protected]>'
          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!

Empty output is not truly empty

When there is no changes to the lock file, an empty composer_diff output is produced, but it's not truly empty.

See log of one oof my workflows:

##[debug]Evaluating: format('{0}
##[debug]', steps.composer_diff.outputs.composer_diff)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> '{0}
##[debug]'
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating Index:
##[debug]........Evaluating steps:
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'composer_diff'
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'outputs'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'composer_diff'
##[debug]..=> ''
##[debug]=> '
##[debug]'
##[debug]Result: '
##[debug]'

then marocchino/sticky-pull-request-comment@v2 fails with Error: Either message or path input is required, but I cannot check if the output is an empty string like '' and skip the step, because it's not an empty string

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.