Skip to content

Use composite action for issue creation #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mre opened this issue Feb 7, 2022 · 4 comments
Closed

Use composite action for issue creation #74

mre opened this issue Feb 7, 2022 · 4 comments
Labels
2.0 enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mre
Copy link
Member

mre commented Feb 7, 2022

See this blog post on the topic and the Github documentation.

This way our example code would change from this:

name: Links

on:
  repository_dispatch:
  workflow_dispatch:
  schedule:
    - cron: "00 18 * * *"

jobs:
  linkChecker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Link Checker
        id: lychee
        uses: lycheeverse/[email protected]
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

      - name: Create Issue From File
        if: ${{ steps.lychee.outputs.exit_code != 0 }}
        uses: peter-evans/create-issue-from-file@v3
        with:
          title: Link Checker Report
          content-filepath: ./lychee/out.md

to this

name: Links

on:
  repository_dispatch:
  workflow_dispatch:
  schedule:
    - cron: "00 18 * * *"

jobs:
  linkChecker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Link Checker
        id: lychee
        uses: lycheeverse/[email protected]
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

We would still use peter-evans/create-issue-from-file, but it would be done internally.

Issue creation could be disabled as well

- name: Link Checker
  uses: lycheeverse/[email protected]
  with:
    create_issue: false
@mre
Copy link
Member Author

mre commented Feb 7, 2022

Since this is a breaking change, a new major version would have to be released.

@mre mre added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Feb 18, 2022
@mre mre added the 2.0 label Mar 10, 2022
@kdeldycke
Copy link
Contributor

The benefits of using peter-evans/create-issue-from-file internally is that you can then address its shortcomings. Like its limitations of reusing previously open issues for updates, and auto-closing open issues that got solved (see peter-evans/create-issue-from-file#298).

To fix these issues, I ended up creating a convoluted workflow. It does the job of:

  • Reusing the previously open issue
  • Closing duplicate issues
  • Closing the previously open issue if broken links are fixed

All my code is available at https://github.com/kdeldycke/workflows/blob/92b66c8b2059e22248eb9ceff6f67bb2b8dea542/.github/workflows/lint.yaml#L173-L266 , for inspiration or copy.

@mre
Copy link
Member Author

mre commented Jun 12, 2023

Good point.
Some people ended up not liking the idea of this composite action. (Can't remember who, right now.) I think the argument was that we would risk diverging from upstream and introduce subtle bugs in our implementation. The action would also do more than just check links, then.
I was hoping for some upstream changes, which would allow us to update an existing issue. In general, if we manage to contribute the functionality there, it would help way more projects and unblock many more use-cases.

@mre
Copy link
Member Author

mre commented Apr 25, 2024

Guess we can close this, as I don't want to go forward with it. See my last comment.
From what I can see, users use lychee-action in various ways and not everyone needs the additional issue-handling functionality, so I'd keep it outside this action to make maintenance easier. Thanks for the input @kdeldycke.

@mre mre closed this as completed Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants