Skip to content

Conversation

imishchuk-carbon
Copy link
Contributor

@imishchuk-carbon imishchuk-carbon commented May 24, 2023

Description

Add support of Github actions in scanner

Changes

  • Add logic to execute scanner in Github actions

How to test

- name: Fossology scanner
  run: |
    docker run --name "fossologyscanner" -w "/opt/repo" -v ${PWD}:/opt/repo \
      -e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
      -e GITHUB_PULL_REQUEST=${{ github.event.number }} \
      fossology/fossology:scanner "/bin/fossologyscanner" nomos ojo

Note, GITHUB_REPOSITORY and GITHUB_ACTIONS are provided by Github action itself, so we do not need to specify it explicitly.

This closes #2450

Copy link

@mhorbul mhorbul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @imishchuk-carbon . Can you please help with following comment?

Also, can you please add a sample GitHub action to the folder utils/automation like the GitLab and Travis sample files?

@GMishx
Copy link
Member

GMishx commented Jun 22, 2023

@imishchuk-carbon , can you please rebase the branch with master to remove the merge commit.

Also, please add a sample file named utils/automation/.github-workflow.yml with a short sample of a GitHub workflow.

@imishchuk-carbon
Copy link
Contributor Author

caught a bug fixed in this commit. Not sure if this is applicable to Gitlab or Travis, though.

For example following change is present in PR

[
  {
    "sha": "fabed087f92842ef3ce2de181bd31c43434767ba",
    "filename": "some-folder/some-file.tsx",
    "status": "renamed",
    "additions": 0,
    "deletions": 0,
    "changes": 0,
    "blob_url": "https://github.com/some-org/some-repo/blob/3311cc4d9f9b2a42cc75803747cacad33fdf0faf/fsome-folder/some-file.tsx",
    "raw_url": "https://github.com/some-org/some-repo/blob/3311cc4d9f9b2a42cc75803747cacad33fdf0faf/fsome-folder/some-file.tsx",
    "previous_filename": "old-folder/some-file.tsx"
  },

This change is missing change_key = "patch" which leads to following exception

Traceback (most recent call last):
  File "/bin/ch-fossologyscanner", line 594, in <module>
    sys.exit(main(sys.argv))
  File "/bin/ch-fossologyscanner", line 541, in main
    cli_options.diff_dir = repo_setup.get_diff_dir()
  File "/bin/ch-fossologyscanner", line 208, in get_diff_dir
    print(re.sub(remove_diff_regex, r"\2", change[change_key]),
KeyError: 'patch'

@GMishx
Copy link
Member

GMishx commented Jun 28, 2023

Hey @imishchuk-carbon , can you please do the following changes so we can proceed with merge?

  1. Provide a sample yaml file for GitHub Action under utils/automation/.github-workflow.yml
  2. Please rebase your branch with upstream master and squash the commits. We are currently seeing 14 commits on this PR. We follow atomic commits, so there should be only 1 commit for a single change.

@imishchuk-carbon imishchuk-carbon force-pushed the feat/support-github-in-scanner branch 2 times, most recently from b8cdfae to 1b8f04f Compare July 1, 2023 10:09
@imishchuk-carbon
Copy link
Contributor Author

Hey @GMishx
Requested items have been done.

Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good.

@imishchuk-carbon imishchuk-carbon force-pushed the feat/support-github-in-scanner branch from 1b8f04f to 90902f2 Compare July 4, 2023 13:10
@github-actions github-actions bot added the has merge conflicts PR to be rebased label Jul 4, 2023
@github-actions
Copy link

github-actions bot commented Jul 4, 2023

This pull request has conflicts, please rebase with master to resolve those before we can evaluate the pull request.

@imishchuk-carbon imishchuk-carbon force-pushed the feat/support-github-in-scanner branch from 90902f2 to 5ea66e7 Compare July 4, 2023 13:13
@github-actions github-actions bot removed the has merge conflicts PR to be rebased label Jul 4, 2023
@imishchuk-carbon imishchuk-carbon force-pushed the feat/support-github-in-scanner branch from 1b80f63 to bb618d1 Compare July 4, 2023 13:15
@imishchuk-carbon imishchuk-carbon force-pushed the feat/support-github-in-scanner branch from bb618d1 to b335136 Compare July 4, 2023 13:16
@GMishx GMishx merged commit 4a72a51 into fossology:master Jul 5, 2023
@imishchuk-carbon imishchuk-carbon deleted the feat/support-github-in-scanner branch July 5, 2023 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support Github actions in scanner

4 participants