Code Monkey home page Code Monkey logo

trigger-workflow-and-wait's People

Contributors

anuruddhal avatar danphillipz avatar duhow avatar grzegorz-faryna-mergermarket avatar hex0cter avatar keithconvictional avatar kwavnet avatar lakshmiravalir avatar neilmayhew avatar shabih-paystack avatar steph0 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trigger-workflow-and-wait's Issues

The requested URL returned error: 404

Hi, I tying to trigger workflow but not in the main branch and it wont work. I used Argument (ref:) with name of branch but always get 404 error. Am I doing something wrong?
image

image

New release

It would be awesome to have the changes since v1.6.3 released as a new version

Seems like this doesn't work in Windows

I am using self-hosted windows runners and I got this error while running the command

Error: Container action is only supported on Linux

...
runs-on: [self-hosted, Windows, X64]
    steps:
      - name: run tests
        uses: convictional/[email protected]
        with:
          github_token: ${{secrets.PAT}}
          owner: ownerX
          repo: repoX
          workflow_file_name: dispatched_tests.yml
name: Dispatched Test
on:
  workflow_dispatch
jobs:

  setup:
    runs-on: [self-hosted, Windows, X64]
    steps:
      - name: setup
        uses: actions/checkout@v2
        uses: ./.github/setup

  test:
    needs: setup
    runs-on: [self-hosted, Windows, X64]
    steps:
      - name: run tests
        uses: ./.github/test

Querying of a workflow state is too aggressive

It is possible to set a timeout which workflow waits until checking the state of the executed remote workflow, but the cycle checking the workflow state should not ask too often for the workflow state (I hit API query limit e.g after couple seconds), there should be a relax interval (configurable), in my case it is enough to set 10secods between checks that workflow is finished.

The action does not wait for the triggered workflow anymore

Hey guys! It seems like something went wrong after releasing version 1.4.0. I just switched to v.1.5.0 after using 1.3.0 and realized that the action is not waiting for the triggered workflow anymore... I have tested v 1.4.0 - the same issue. Downgrading to v 1.3.0 solves the problem. But I need the feature from the latest release. ๐Ÿ˜„

Please take a look, maybe you can find a quick solution? Can you reproduce it at all? ๐Ÿค”

Here's the screenshot of my output:
Screen Shot 2021-07-27 at 16 11 58

Incorrect workflow_id when 2 matrix jobs triggers `trigger-workflow-and-wait` at the same time

Hi guys,

I am facing this issue in this context:
For instance, I have 2 repositories such as

  • github.com/example/main (main repo)
name: master ci
on:
  push:
    branches:
      - 'master'
jobs:
  build_ci:
    name: build_ci
    steps:
      - run: echo "master ci"
  run_e2e:
    name: run_e2e
    strategy:
      fail-fast: false
      matrix:
        target: [test01, test02]
    needs: build_ci
    steps:
      - uses: convictional/[email protected]
        name: trigger ${{ matrix.target }} and wait for it
        with:
          owner: ${{ github.repository_owner }}
          repo: test
          github_token: ${{ secrets.GH_DISPATCH_TOKEN }}
          workflow_file_name: dispatch_ci.yml
          ref: master
          wait_interval: 10
          client_payload: '{"testsuite":"${{ matrix.target }}"}'
          propagate_failure: true # Fail current job if downstream job fails.
          trigger_workflow: true
          wait_workflow: true

  • github.com/example/test (test repo)
name: Dispatch CI
on:
  workflow_dispatch:
    inputs:
      testsuite:
        description: 'a Set of test cases'
        required: true
        default: 'test01'
        type: choice
        options:
        - test01
        - test02

jobs:
  dispatch-ci:
    name: run ${{ inputs.testsuite }} test
    runs-on: ci-general
    if: github.ref == 'refs/heads/master'
    steps:
      - uses: actions/checkout@v3
      - name: return random for testing purpose
        run: |
          sleep 5

The dispatch-ci job in Dispatch CI workflow has been triggered via the change of master branch in the main repo.

But the thing is that it triggered it successfully but the result of checking the dispatch-ci job is incorrect.

After reading the code, I realized that there are 2 points

  • Github action returns 204 with no content in case of calling worklows/dispatches. I have tried locally, and it returns 204No Content
  • For the first point, trigger_workflow() func is implemented by comparing old and new run ID which lead to some mistakes in case of multiple triggers at the same time.

I'd like to raise this issue for further discussion to find alternative solutions which we can contribute wherever in this actions plugin or Github actions API ....

Doesn't propagate downstream failure from JUnit results

Assume I have a workflow (we'll call the downstream workflow) which runs tests which reports their results as a JUnit result which then sets a commit status check as pass or fail depending on if the JUnit results show failure or not. This status reporting of a JUnit file is done with EnricoMi/publish-unit-test-result-action@v2 FWIW. Probably more detail than necessary but I think the main point here is that the downstream job can post failures in the commit status.

When a workflow (that we'll call the upstream workflow) that triggers/dispatches this downstream workflow using convictional/trigger-workflow-and-wait and sets propagate_failure: true runs, it does not propagate this failure into the upstream workflow.

To demonstrate through actual results, here is the upstream workflow result: https://github.com/daos-stack/argobots/actions/runs/3540793297/jobs/5944319147

The downstream result, as you know will be in the result above.

If I make the downstream workflow exit with a failure, the failure is propagated to the upstream job. So it seems failure propagation only happens if a step in the downstream workflow fails, but not if all steps were successful but a commit status reports a failure.

Warning with custom waiting interval value

Hello,

While executing this with custom waiting interval set to 180seconds, i have the following waning:

Warning: Unexpected input(s) 'waiting_interval', valid inputs are ['entryPoint', 'args', 'owner', 'repo', 'github_token', 'ref', 'wait_interval', 'workflow_file_name', 'inputs', 'propagate_failure', 'trigger_workflow', 'wait_workflow']

Version: 1.3.0 (the next versions have an issue, the step do not wait for the distant workflow to finish, so i have to keep 1.3.0, I can't upgrade).

Joel

workflow outputs

Hello.
Thank for the workflow. Can you answer my questions, please?

  • Can you add in outputs a URL link on workflow what we launch?
  • How to write launch results, URL in PR?

Intermittently getting Bad Credentials

Hello,

We're intermittently getting bad credentials while using this action. This is our snippet:

      - name: Trigger SDK Build
        if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop')  
        uses: convictional/[email protected]
        with:
          owner: <our org>
          repo: <our repo>
          github_token: ${{ secrets.DAIS_DEVOPS_TEAM_ACTIONS_PERSONAL_ACCESS_TOKEN }}
          workflow_file_name: main.yml
          wait_workflow: false
          ref: master

Error in the attached log file.

Thanks.

trigger-sdk-build.log

Is it possible to add example with valid payload which trigger and wait for workflow in other repository?

I provided a json string

- name: Execute deployment and wait for finish
        uses: convictional/[email protected]
        with:
          owner: ME
          repo: my-workflows
          github_token: ${{ secrets. GITHUB_TOKEN }}
          github_user: ${{ github.event.client_payload.actor }}
          workflow_file_name: deployment.yml
          ref: ${{ github.event.inputs.ref }}
          client_payload: '{"ref": "master", "inputs": {"repository": "${{ github.event.inputs.repository }}", "ref": "${{ github.event.inputs.ref }}", "environment": "${{ github.event.inputs.environment }}", "service_to_deploy": "${{ github.event.inputs.service_to_deploy }}"}}'

But I get an error on the payload:

curl: (22) The requested URL returned error: 422 is not a string

Incorrect behaviour for triggering workflow with missing input

Expected behaviour

  • When triggering a workflow, if the required inputs of the workflow are missing, the action should throw an error.

Current behaviour

  • When triggering a workflow, if the required inputs of the workflow are missing, the action did not throw any error

Action version: 1.3.0

Simultaneous invocation can cause inconclusive results

In the function wait_for_workflow_to_finish we are getting the last/latest workflow run...

Imagine we have Repo A, B & C. A & C both invoke the workflow from B let's say almost @ the same time. With the current logic we will never know which run was initiated by which Repo.

[question] does "trigger-workflow-and-wait" trigger an old running ?

First of all, I am quite new to GitHub action. I run into an issue when use trigger-workflow-and-wait to trigger another workflow

my report has 2 branches: develop and main.
and I have 2 workflow files
github-actions-demo.yml: to create a Pull Request that merge develop into main
trigger-another-workflow.yml: to trigger github-actions-demo.yml workflow

this is trigger-another-workflow.yml:

name: demo-trigger-another-workflow

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
     # do more some steps here
  create_pr:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: convictional/[email protected]
        with:
          owner: tranducduong1994
          repo: Practice-github-Action
          github_token: ${{ secrets.GITHUB_TOKEN }}
          workflow_file_name: github-actions-demo.yml
          ref: main
          propagate_failure: false
          trigger_workflow: true
          wait_workflow: true

When I trigger it manually, it was successful
image

But there isn't any new Pull Request. I open and see detail, it said that:
The workflow id is [1509634586].
Conclusion is not success, its ["cancelled"].

1509634586 is an old workflow that I cancelled manually before. Did I misunderstand something? I thought trigger-workflow-and-wait create a new run and trigger it.

Keep a major version tag

Hey, it would be cool if you kept a major version tag so that one doesn't need to worry about updating the version until there's a breaking change.
You can do that automatically like in this workflow, where the major version tag is updated on with every release ;)

always getting 404 when triggering the downstream job

Hi,

When I tried to trigger another repo job, I am always getting 404, I have manually run the job using curl command to https://api.github.com it executed well. I am using correct github token, owner, user.

when I looked the entrypoint script the curl command is different, I had to pass -d '{"ref":"main"}', headers that I am passing are
-H "Authorization: token ", -H "Accept: application/vnd.github.v3+json" , I noticed in the entrypoint it is using Bearer token.
Can you help me to resolve the issue.

wait_interval cannot be set

It's seems that I cannot set the wait_interval to a custom value. If I set it to 20 in my github workflow, it still uses the default of 10 seconds.

I'm pretty new to github actions, but I would guess the problem is, that entrypoint.sh#L16 wants to read the environment variable "INPUT_WAITING_INTERVAL" instead of the declared action input wait_interval in action.yml#L35.

ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code

[Container] 2024/03/27 12:58:52 #3 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/alpine/manifests/sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
[Container] 2024/03/27 12:58:52 ------
[Container] 2024/03/27 12:58:52 > [internal] load metadata for docker.io/library/alpine:3.15.0:
[Container] 2024/03/27 12:58:52 ------
[Container] 2024/03/27 12:58:52 ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/alpine/manifests/sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
Warning: Docker build failed with exit code 1, back off 8.237 seconds before retry.
[Container] 2024/03/27 12:59:00 /usr/local/bin/docker build -t 1f8c8b:a9f77041649544949260b64727f8b766 -f "/codebuild/readonly/action-runner/_layout/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.1/Dockerfile" "/codebuild/readonly/action-runner/_layout/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.1"
[Container] 2024/03/27 12:59:00 #0 building with "default" instance using docker driver
[Container] 2024/03/27 12:59:00
[Container] 2024/03/27 12:59:00 #1 [internal] load build definition from Dockerfile
[Container] 2024/03/27 12:59:00 #1 transferring dockerfile: 32B done
[Container] 2024/03/27 12:59:00 #1 DONE 0.0s
[Container] 2024/03/27 12:59:00
[Container] 2024/03/27 12:59:00 #2 [internal] load .dockerignore
[Container] 2024/03/27 12:59:00 #2 transferring context: 2B done
[Container] 2024/03/27 12:59:00 #2 DONE 0.0s
[Container] 2024/03/27 12:59:00
[Container] 2024/03/27 12:59:00 #3 [internal] load metadata for docker.io/library/alpine:3.15.0
[Container] 2024/03/27 12:59:02 #3 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/alpine/manifests/sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
[Container] 2024/03/27 12:59:02 ------
[Container] 2024/03/27 12:59:02 > [internal] load metadata for docker.io/library/alpine:3.15.0:
[Container] 2024/03/27 12:59:02 ------
[Container] 2024/03/27 12:59:02 ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/alpine/manifests/sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
Warning: Docker build failed with exit code 1, back off 7.935 seconds before retry.
[Container] 2024/03/27 12:59:10 /usr/local/bin/docker build -t 1f8c8b:a9f77041649544949260b64727f8b766 -f "/codebuild/readonly/action-runner/_layout/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.1/Dockerfile" "/codebuild/readonly/action-runner/_layout/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.1"
[Container] 2024/03/27 12:59:10 #0 building with "default" instance using docker driver
[Container] 2024/03/27 12:59:10
[Container] 2024/03/27 12:59:10 #1 [internal] load build definition from Dockerfile
[Container] 2024/03/27 12:59:10 #1 transferring dockerfile: 32B done
[Container] 2024/03/27 12:59:10 #1 DONE 0.0s
[Container] 2024/03/27 12:59:10
[Container] 2024/03/27 12:59:10 #2 [internal] load .dockerignore
[Container] 2024/03/27 12:59:10 #2 transferring context: 2B done
[Container] 2024/03/27 12:59:10 #2 DONE 0.0s
[Container] 2024/03/27 12:59:10
[Container] 2024/03/27 12:59:10 #3 [internal] load metadata for docker.io/library/alpine:3.15.0
[Container] 2024/03/27 12:59:12 #3 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/alpine/manifests/sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
[Container] 2024/03/27 12:59:12 ------
[Container] 2024/03/27 12:59:12 > [internal] load metadata for docker.io/library/alpine:3.15.0:
[Container] 2024/03/27 12:59:12 ------
[Container] 2024/03/27 12:59:12 ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/alpine/manifests/sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
Error: Docker build failed with exit code 1
[Container] 2024/03/27 12:59:12.127697 Command failed with exit status 2
[Container] 2024/03/27 12:59:12.133771 Phase complete: POST_BUILD State: FAILED_WITH_ABORT
[Container] 2024/03/27 12:59:12.133870 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: - name: Trigger E2E Test Workflow
uses: convictional/[email protected]
with:
github_token: $GITHUB_ACCESS_TOKEN

trigger_workflow: "true"
wait_interval: "30"
wait_workflow: "true"
workflow_file_name: e2e-tests-pipeline.yml

. Reason: exit status 2

github_user input not url encoded

When this kicks off a workflow using github_token: ${{ github.token }} the actor is github-actions[bot]. When passing that into the github_user input it will fail since it is not url encoded to github-actions%5Bbot%5D.
I am currently working around this by url encoding the user myself.
Would be nice for it to handle this itself although I understand this is probably a rare case since most people are probably using this to start private workflows and not public ones and thus would have a normal github_user name that doesn't need encoded.

Error: Docker build failed with exit code 1

The docker container seems to be failing to build when using the action in my workflow.

Build container for action use: '/home/runner/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.5/Dockerfile'.
  /usr/bin/docker build -t b1cbc5:c6be9eee68894c6[2](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:2)80b6abd491574508 -f "/home/runner/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.5/Dockerfile" "/home/runner/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.5"
  Sending build context to Docker daemon  25.09kB
  
  Step 1/4 : FROM alpine:[3](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:3).15.0
  3.15.0: Pulling from library/alpine
  59bf1c3509f3: Pulling fs layer
  59bf1c3509f3: Verifying Checksum
  59bf1c3509f3: Download complete
  59bf1c3509f3: Pull complete
  Digest: sha256:21a3deaa0d32a805791[4](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:4)f36[5](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:5)84b5288d2e5ecc984380bc0118285c70fa8c9300
  Status: Downloaded newer image for alpine:3.15.0
   ---> c059bfaa849c
  Step 2/4 : RUN apk update &&     apk --no-cache add curl jq coreutils
   ---> Running in 85db98950493
  cgroups: cgroup mountpoint does not exist: unknown
  Warning: Docker build failed with exit code 1, back off 4.135 seconds before retry.
  /usr/bin/docker build -t b1cbc5:c[6](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:6)be9eee68894c6280b6abd4915[7](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:7)450[8](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:8) -f "/home/runner/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.5/Dockerfile" "/home/runner/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.5"
  Sending build context to Docker daemon  25.0[9](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:9)kB
  
  Step 1/4 : FROM alpine:3.15.0
   ---> c059bfaa849c
  Step 2/4 : RUN apk update &&     apk --no-cache add curl jq coreutils
   ---> Running in [12](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:12)c08bfcc897
  cgroups: cgroup mountpoint does not exist: unknown
  Warning: Docker build failed with exit code 1, back off 1.[15](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:15)1 seconds before retry.
  /usr/bin/docker build -t b1cbc5:c6be9eee68894c6280b6abd491574508 -f "/home/runner/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.5/Dockerfile" "/home/runner/_work/_actions/convictional/trigger-workflow-and-wait/v1.6.5"
  Sending build context to Docker daemon  [25](https://github.com/{owner}/{repo}/actions/runs/4566284901/jobs/8058595277#step:2:25).09kB
  
  Step 1/4 : FROM alpine:3.15.0
   ---> c059bfaa849c
  Step 2/4 : RUN apk update &&     apk --no-cache add curl jq coreutils
   ---> Running in 38799b4d8ee7
  cgroups: cgroup mountpoint does not exist: unknown
Error: Docker build failed with exit code 1

Action doesn't complete even if triggered workflow finished successfully

Since yesterday I have the problem that the latest version v1.6.0 can trigger another workflow but the action doesn't get the triggered workflow run and so it runs forever:

Getting workflow runs using query: event=workflow_dispatch&created=>=2022-04-13T13:21:14+00:00&actor=&per_page=100
Triggering workflow:
  workflows/test_called.yml/dispatches
  {"ref":"main","inputs":{
  "Test_input": "Test_value"
}}
Sleeping for 10 seconds
Getting workflow runs using query: event=workflow_dispatch&created=>=2022-04-13T13:21:14+00:00&actor=&per_page=100
Sleeping for 10 seconds
Getting workflow runs using query: event=workflow_dispatch&created=>=2022-04-13T13:21:14+00:00&actor=&per_page=100
Sleeping for 10 seconds
...

I verified the other workflow was triggered after the timestamp and it also finished successfully.
I used the action as follows:

- uses: convictional/[email protected]
  with:
    owner: my_org
    repo: my_repo
    github_token: ${{ secrets.MY_PAT }}
    workflow_file_name: test_called.yml
    client_payload: '{"Test_input": "Test_value"}'

Any idea why this happens and am I the only one with this problem?
I reverted back to v1.3.0 for now which works fine.

`wait_interval` name mismatch

  • The DockerFile gets its wait time from $INPUT_WAITING_INTERVAL -- where the documentation suggests a wait_interval
  • Supplying a wait_interval does not change the timeout, a waiting_interval must be supplied

parse error

I cannot understand the parse error. How can I read column 17 with this output?

Run convictional/[email protected]
  with:
    owner: owner
    repo: somerepo
    github_token: ***
    github_user: user
    workflow_file_name: build-broker-service.yml
    ref: tag-and-images
    client_payload: { image_tag=test }
    propagate_failure: false
    trigger_workflow: true
    wait_workflow: true
    comment_github_token: ***
/usr/bin/docker run --name ca2e78c453d0d4b2299c9198d5ba0c465_f97808 --label 49859c --workdir /github/workspace --rm -e "INPUT_OWNER" -e "INPUT_REPO" -e "INPUT_GITHUB_TOKEN" -e "INPUT_GITHUB_USER" -e "INPUT_WORKFLOW_FILE_NAME" -e "INPUT_REF" -e "INPUT_CLIENT_PAYLOAD" -e "INPUT_PROPAGATE_FAILURE" -e "INPUT_TRIGGER_WORKFLOW" -e "INPUT_WAIT_WORKFLOW" -e "INPUT_COMMENT_GITHUB_TOKEN" -e "INPUT_WAIT_INTERVAL" -e "INPUT_COMMENT_DOWNSTREAM_URL" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/cads-deployment/cads-deployment":"/github/workspace" 49859c:a2e78c453d0d4b2299c9198d5ba0c465
parse error: Invalid numeric literal at line 1, column 17

This is the workflow build-images.yml:

on:
  workflow_dispatch:
    inputs:
      image_tag:
        description: 'Release tag'
        required: true
        default: 'test'

jobs:

  build_remote_workflow:
    runs-on: ubuntu-latest
    steps:
    - name: Trigger remote workflow
      uses: convictional/[email protected]
      with:
        owner: owner
        repo: somerepo
        github_token: ${{ secrets.CADS_PAT }}
        github_user: user
        workflow_file_name: build-broker-service.yml
        ref: tag-and-images
        client_payload: '{ image_tag=${{ github.event.inputs.image_tag }} }'
        propagate_failure: false
        trigger_workflow: true
        wait_workflow: true

this is the workflow that should be triggered:

on:
  workflow_dispatch:
    inputs:
      image_tag:
        description: 'Image tag'
        required: true
        default: 'latest'
  workflow_run:
    workflows: 
      - owner/otherepo/build-images.yml
    types: [requested]

Including a Branch for `ref` Doesn't Appear to Work

I am trying to trigger a workflow from a release branch in another repo.

If I include ref: release or ref: refs/heads/release I get the following error:

"message": "Not Found"

I confirmed that I can see the workflow on the branch for the repo I'm dispatching the event to. I am using convictional/[email protected]

Is it possible to trigger enterprise workflow and wait?

I want to trigger a enterprise github workflow from a non enterprise github workflow. Is there any way I can do this?
As I saw here, I will not be able to provide any github_server_url

- uses: convictional/[email protected]
  with:
    owner: keithconvictional
    repo: myrepo
    github_token: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }}
    workflow_file_name: main.yml
    ref: release-branch
    wait_interval: 10
    inputs: '{}'
    propagate_failure: false
    trigger_workflow: true
    wait_workflow: true

Can't use SHA as `ref`

README.md:
image

When passing a SHA as ref, I get:

{
  "message": "No ref found for: 64d9f66f1df87cd18c204770810acaec836dfadb",
  "documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}

Github docs:

ref: Required. The git reference for the workflow. The reference can be a branch or tag name.

When the calling workflow is cancelled โ€ฆ

Any thoughts on having the triggered workflow cancelled when the calling workflow is cancelled? At least as an option?

Any thoughts on how to do this in a subsequent step even? I suppose at a minimum the action would have to have some kind of output to provide the next step with some identifier of what to cancel.

Happy to hear any thoughts you have on this topic.

Is it possible to trigger dependency workflow?

Hi I wonder if I could use this to trigger dependency projects per main project's labels on a pr merge. So it can dynamic trigger dependency workflow on variables. Is that possible?

Also, is it possible to pass parameters to the dependency workflow?

Thanks

Is this still working? getting "not found"

https://api.github.com/repos/owner/repo/myrepo/actions/workflows/release_push.yaml/dispatches
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
{
100 29 0 0 100 29 0 222 --:--:-- --:--:-- --:--:-- 221
100 113 100 84 100 29 469 162 --:--:-- --:--:-- --:--:-- 631
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest"
}

Here is what I have in my 1st repo workflow:

- name: Check Client build success uses: convictional/[email protected] with: repo: xxx/myrepo owner: ${{ secrets.ORG_GHUSER }} github_token: ${{ secrets.ORG_GHTOKEN }} ref: develop wait_workflow: true workflow_file_name: release_push.yaml propagate_failure: true trigger_workflow: true

Curl errors

I'm getting an error that appears to be due to curl:

Getting workflow runs using query: event=workflow_dispatch&created=>=2023-03-21T20:27:10+00:00&actor=&per_page=100
curl: (16) Error in the HTTP2 framing layer
api failed:
path: workflows/deploy.yml/runs?event=workflow_dispatch&created=>=2023-03-21T20:27:10+00:00&actor=&per_page=100
response: 

This is happening in v1.6.5 and 1.6.4 consistently. It appears to be related to the curl install which is being baked into the image I believe so not sure if there's anything I can change on the config side to work around it

Returning already finished workflow

First message in triggering repo I see is

"message": "Workflow does not have 'workflow_dispatch' trigger"
And then it tries again and after success I see this:
The workflow id is [123]
After that when I check my triggered repo this id 123 is in already finished workflow from few days ago. Not the new one.
This is in the organization repo.
Is it a normal behaviour?

Unexpected inputs provided when providing client_payload

Hello!
I've issue when I try to pass client payload using trigger-workflow-and-wait:

curl: (22) The requested URL returned error: 422
api failed:
path: workflows/workflow.yml/dispatches
response: {
"message": "Unexpected inputs provided: ["remote_repo"]",
"documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}

According to README I should use JSON syntax in client_payload and this is what I'm using: client_payload: '{"remote_repo": "${{ github.event.repository.name }}"}'

Thanks in advance for help!

Invalid value for input

Hi.

I'm trying to trigger a job with an input defined as:

      functional-test-distros:
        description: 'Distros to run Functional testing on (i.e. el8, el8, leap15, etc.)'
        required: false

and trying to pass a JSON array as the value. For example: ["el8","el9","leap15"].

Doing this works fine when I run the workflow manually from the GitHub Actions UI.

When I try to pass that JSON string as an input from trigger-workflow-and-wait I get an error. Here is the output from the entire trigger-workflow-and-wait step:

Run convictional/[email protected]
/usr/bin/docker run --name d721bd2654f1f8c633608c4af3303_bf7aea --label 242307 --workdir /github/workspace --rm -e "EL8_BUILD_VERSION" -e "EL9_BUILD_VERSION" -e "LEAP15_VERSION" -e "DISTROS" -e "TEST_TAG" -e "INPUT_OWNER" -e "INPUT_REPO" -e "INPUT_GITHUB_TOKEN" -e "INPUT_COMMENT_DOWNSTREAM_URL" -e "INPUT_WORKFLOW_FILE_NAME" -e "INPUT_REF" -e "INPUT_WAIT_INTERVAL" -e "INPUT_CLIENT_PAYLOAD" -e "INPUT_PROPAGATE_FAILURE" -e "INPUT_GITHUB_USER" -e "INPUT_TRIGGER_WORKFLOW" -e "INPUT_WAIT_WORKFLOW" -e "INPUT_COMMENT_GITHUB_TOKEN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/jenkins/gha_runners/actions-runner1/_work/_temp/_github_home":"/github/home" -v "/jenkins/gha_runners/actions-runner1/_work/_temp/_github_workflow":"/github/workflow" -v "/jenkins/gha_runners/actions-runner1/_work/_temp/_runner_file_commands":"/github/file_commands" -v "/jenkins/gha_runners/actions-runner1/_work/argobots/argobots":"/github/workspace" 242307:422d721bd2654f1f8c633608c4af3303
Getting workflow runs using query: event=workflow_dispatch&created=>=2024-04-23T22:09:36+00:00&actor=&per_page=100
Triggering workflow:
  workflows/rpm-build-and-test.yml/dispatches
  {"ref":"bmurrell/run-on-dispatch","inputs":{"pr-repos":"argobots@PR-23","commit-message":"Override commit pragmas","test-tag":"load_mpi test_core_files always_passes,vm","rpm-test-version":"2.5.101","functional-test-distros":["el8","el9","leap15"]}}
curl: (22) The requested URL returned error: 422
api failed:
path: workflows/rpm-build-and-test.yml/dispatches
response: {
  "message": "Invalid value for input 'functional-test-distros'",
  "documentation_url": "https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event"
}

The JSON string is valid:

$ echo '{"ref":"bmurrell/run-on-dispatch","inputs":{"pr-repos":"argobots@PR-23","commit-message":"Override commit pragmas","test-tag":"load_mpi test_core_files always_passes,vm","rpm-test-version":"2.5.101","functional-test-distros":["el8","el9","leap15"]}}' | json_pp
{
   "inputs" : {
      "commit-message" : "Override commit pragmas",
      "functional-test-distros" : [
         "el8",
         "el9",
         "leap15"
      ],
      "pr-repos" : "argobots@PR-23",
      "rpm-test-version" : "2.5.101",
      "test-tag" : "load_mpi test_core_files always_passes,vm"
   },
   "ref" : "bmurrell/run-on-dispatch"
}

So while I can appreciate that this action is just passing along an error from the API, do you have any further thoughts on why this works when run interactively from GitHub Actions UI but not via the API?

Problems Running in an Enterprise environment (Syntax error?)

I have changed both URLs (API and Server) to our own. However, when trying to run the workflow, there is a syntax error in the entrypoint.sh file:
image

However, I am not sure if I can just remove line 144 or not.
Line 144 was unchanged from the code:
join -v2 <(echo "$OLD_RUNS") <(echo "$NEW_RUNS")

This error pops up on the Run command.

The only thing different otherwise (apart from our own server and api links) that we may have is that we're using alpine version 3.14.1. Is this version okay too?

Thank you, and have a nice day.

Workflow not stopping after using wait_workflow

    - name: Trigger other workflow
       uses: convictional/[email protected]
       with:
         owner: prabhat2k15
         repo: helm
         ref: script-fix
         github_token: ${{ secrets.xyz }}
         github_user: github-user
         workflow_file_name: deploy-dev.yaml
         client_payload: '{"x":"y","z":"${{github.run_id}}"}'
         propagate_failure: false
         trigger_workflow: true
         wait_workflow: false
Screenshot 2023-10-05 at 3 25 23 PM

this infinitely wait and workflow not stopping.
wht's the fix?

Skip if workflow has already run

Is there any method to skip triggering the workflow if it has already run ?

For example, I have a workflow which builds/compiles an app. I then have some other workflows (like nightly tests, weekend soaks, etc.) which will fetch/download the build and run some tests. However these items can also be executed independently, so we are unsure if a build is started/not run/etc. and want to avoid wasting time on a re-run.

Cannot see actual status of downstream job

The propagate_failure option does not account for other statuses returned by the downstream job, so the action only returns failure or success. The conclusion environment variable holds the actual status reported by the downstream job. I propose exporting it as an output from the action for use in subsequent steps that may need to respond to whether the job timed out, was skipped, was cancelled, and so on.

Command Injection Bug

sleep call on line 87 of entrypoint.sh is vulnerable to command injection via the INPUT_WAIT_INTERVAL environment variable. See Pull request #69 for related fix.

Matrix jobs all log fail if only one fails

If I create a workflow with a job that uses convictional/trigger-workflow-and-wait as a step in a 2 axis matrix, if (even only) one of the matrix jobs fails, all of them show as failed in the workflow.

Additionally, both jobs in the workflow show the work of convictional/trigger-workflow-and-wait for both of the axes of the matrix.

See https://github.com/daos-stack/argobots/actions/runs/3541802004/jobs/5946573980 for an example of this. Only Test RPMs on EL 8 (release/2.2) actually failed. _Test RPMs on EL 8 (master) actually succeeded.

Scopes needed on the PAT

Could update the README with the scopes needed on that PAT?

Is it possible to use the GITHUB_TOKEN instead of a PAT? If so might be worth adding that the README also.

curl returns 502 randomly

Checking conclusion [null]
Checking status [queued]
Sleeping for 10 seconds
Checking conclusion [null]
Checking status [queued]
curl: (22) The requested URL returned error: 502
api failed:
path: runs/2830763366
response: {
  "message": "Server Error"
}

this can be seen randomly, making the pipeline fail, even though the called workflow is still running and fine.
From my perspective it would be safe to ignore error 5xx

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.