workflow-dispatch icon indicating copy to clipboard operation
workflow-dispatch copied to clipboard

Rework getWorkflowRunId() when run-name is provided

Open LudovicTOURMAN opened this issue 2 years ago • 11 comments

Issue: As discussed here, I figured out that the current function octokit.rest.checks.listForRef, which is based on repos/OWNER/REPO/commits/REF/check-runs, and used to retrieve the run id, when a run-name is provided, is not working.

Cause is that check_name is filled by Github with the jobs.<job_id> (or jobs.<job_id>.name) and not the run-name we are expecting.

Solution: The default octokit.rest.actions.listWorkflowRuns currently used is also the proper one to filter based on the name. So once we use the method, we only need to do an extra filter on the name attribute to match the proper run-name. To limit the number of results, created parameter has also been set on the API call.

Since the two recent functions findWorkflowRunIdFromFirstRunOfSameWorkflowId and findWorklowRunIdFromRunName are merged back into getWorkflowRunId, I cleaned them.

Extra changes:

  • Add workflow-id as output
  • Add 2 new modes for workflow-logs:
    • output: Set remote workflow logs (as raw) in workflow-logs output
      <job-name> | yyyy-MM-ddTHH:mm:ss.SSSSSSSZ <message>
      <job-name> | yyyy-MM-ddTHH:mm:ss.SSSSSSSZ <message>
      
    • json-output: Set remote workflow logs (as json object) in workflow-logs output
      {
        "<job-name>": [
          {
            "datetime": "yyyy-MM-ddTHH:mm:ss.SSSSSSSZ",
            "message": "<message>"
          },
          {
            "datetime": "yyyy-MM-ddTHH:mm:ss.SSSSSSSZ",
            "message": "<message>"
          }
        ]
      }
      
  • README.md
    • Do some lint
    • Add an extra example (with corresponding remote workflow) when using run-name
  • action.yaml
    • Add outputs definition
  • Fix some typos (shoud, tirggered, Muse)

LudovicTOURMAN avatar Dec 29 '23 11:12 LudovicTOURMAN

Here are the test results for the last commit 1fda9fc: https://github.com/LudovicTOURMAN/workflow-dispatch/actions/runs/7395335486

LudovicTOURMAN avatar Jan 03 '24 12:01 LudovicTOURMAN

Hello @aurelien-baudet, will you be able to have a look at this PR? Thank you :blush:

LudovicTOURMAN avatar Jan 09 '24 09:01 LudovicTOURMAN

Hello @aurelien-baudet, will you be able to have a look at this PR? Thank you 😊

bump

evanlindsey avatar Feb 23 '24 20:02 evanlindsey

@LudovicTOURMAN Hi, looks like this action is abandoned from the Author. You seem like to know the topic as above discussion takes place. Can you fork the original one 'benc-uk/workflow-dispatch' (which looks also abandoned) towards your repo GH actions? and upgrade it to Node20 ?

thepsc-go avatar Mar 06 '24 08:03 thepsc-go

@LudovicTOURMAN Bump.

@LudovicTOURMAN Hi, looks like this action is abandoned from the Author. You seem like to know the topic as above discussion takes place. Can you fork the original one 'benc-uk/workflow-dispatch' (which looks also abandoned) towards your repo GH actions? and upgrade it to Node20 ?

ALEEF02 avatar Mar 27 '24 17:03 ALEEF02

Please make some small changes to make code more readable. I will merge once it's done.

Thanks for the feedback @aurelien-baudet. I've been able to rework the function to make it lighter and more readable.

LudovicTOURMAN avatar Apr 11 '24 15:04 LudovicTOURMAN

Please make some small changes to make code more readable. I will merge once it's done.

Bump

fbiesse avatar May 09 '24 20:05 fbiesse

Sorry, I have no more time and energy to maintain this repository. I even don't have computer anymore. Someone of you should for this repository and merge the different pull requests. Tell me who creates the fork and I will archive this repository but indicate which repository follows up

aurelien-baudet avatar May 10 '24 06:05 aurelien-baudet

@LudovicTOURMAN I wanted to know if you're planning to take over on this action. If not, I propose to create a fork, update readme, integrate your developments and maintain it. Tell me

fbiesse avatar May 13 '24 07:05 fbiesse

@LudovicTOURMAN I wanted to know if you're planning to take over on this action. If not, I propose to create a fork, update readme, integrate your developments and maintain it. Tell me

Hello @fbiesse, we are already using some private fork within my company. So I'm not going to maintain another public one. Go ahead if you would like to pick all of those for the community (and thanks).

@aurelien-baudet, no worry. That was still nice you provided this composite. Thanks for the work you've done and have a nice "repo-tirement"

LudovicTOURMAN avatar May 13 '24 07:05 LudovicTOURMAN

@LudovicTOURMAN Thank you, actually I have the same need for my company. @aurelien-baudet Thank you too for this repo and all the work done on this one, I'll do my fork in the week.

fbiesse avatar May 13 '24 07:05 fbiesse

@aurelien-baudet I created the fork with all PR merged ? Can you please transfer the action to my repo (https://github.com/fbiesse/workflow-dispatch) https://docs.github.com/en/actions/creating-actions/publishing-actions-in-github-marketplace#transferring-an-action-repository Thank you again for all the work.

fbiesse avatar May 14 '24 07:05 fbiesse

I tried to transfer repository but it fails with "fbiesse/workflow-dispatch already exists". Maybe the best would be to create an organization instead of a single user to be able to maintain it by several people. So I could then transfer ownership to this organization and let you handle several maintainers and admins

aurelien-baudet avatar May 25 '24 03:05 aurelien-baudet

@aurelien-baudet let’s do it. i just created @the-actions-org and invited you. we can add users from this thread and future maintainers once the repo is transferred.

evanlindsey avatar May 25 '24 05:05 evanlindsey

There is an error "You don’t have the permission to create public repositories on the-actions-org". I think I must be admin of this organization first before being able to transfer the repository

aurelien-baudet avatar May 25 '24 06:05 aurelien-baudet

There is an error "You don’t have the permission to create public repositories on the-actions-org". I think I must be admin of this organization first before being able to transfer the repository

It looks like the transfer succeeded. I went ahead and changed the base permissions for org members to write. Let me know if you’re still seeing issues?

evanlindsey avatar May 25 '24 06:05 evanlindsey

@fbiesse I created the org and took transfer of the repo to help expedite remaining actions and responses (since I still receive updates from this thread). I'm not really interested in maintaining it, as I found a different solution and no longer use this. I added you to the-actions-org and made you a maintainer on this repo. @LudovicTOURMAN I gave you write permissions to this repo, which should allow you to go ahead and merge this PR.

evanlindsey avatar May 29 '24 17:05 evanlindsey

@evanlindsey thank you, it will be definitely more convenient. The think I can do is to create a PR with the last things I did on my fork (it already have both PR merged and tested) and rename the username part in the Readme. I'll be back of vacation in 2 weeks, I'll do it when I'll be back.

fbiesse avatar May 29 '24 19:05 fbiesse

@evanlindsey I'm back from vacations, but I couldn't accept the invitation to the new repo in time. Can you please resend me the invitation ? Thank you.

fbiesse avatar Jun 11 '24 14:06 fbiesse

@evanlindsey I'm back from vacations, but I couldn't accept the invitation to the new repo in time. Can you please resend me the invitation ? Thank you.

@fbiesse welcome back and no problem! it looks like you were able to accept the member invite for the-actions-org and I just gave you the maintain role on this specific repo.

evanlindsey avatar Jun 12 '24 04:06 evanlindsey

@evanlindsey perfect, thank you !

fbiesse avatar Jun 12 '24 07:06 fbiesse