-
I have a CI workflow that listens to the name: "Sync"
on:
release:
types:
- "created" If I create a release manually via GitHub UI, this sync workflow runs as expected. However, this workflow doesn't work when the releases are made via Is this normal? Does Update: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I have figured out the answer on my own by arriving at this StackOverflow Q&A and talking to ChatGPT4. Turns out that GitHub Actions prevents recursive workflows by design. Here's the full response given by ChatGPT4: Yes, it is normal for releases made by `github-actions` to not trigger a `release` webhook event when the action is running in the same repository. This is because GitHub Actions [prevents recursive workflows](https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token) by design.
To work around this limitation, you can use a personal access token (PAT) to authenticate when creating the release, which will allow the `release` webhook event to trigger other workflows in the same repository. Here's how to do it:
1. Create a personal access token (PAT) with the `repo` scope following [these instructions](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token).
2. Add the PAT to your repository secrets. Go to the "Settings" tab of your repository, click on "Secrets" in the left sidebar, and then click the "New repository secret" button. Give it a name like `PAT` and paste the token you created in step 1.
3. Update your `release.yml` workflow to use the PAT instead of the default `GITHUB_TOKEN`. You can do this by modifying the `env` section of the `git-release` step:
```yaml
steps:
- name: Git Release
uses: anton-yurchenko/git-release@v3.1.1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
...
```
Now, when the `git-release` action creates a release, it should trigger your `Sync` workflow as expected, since it will be using your personal access token instead of the default `GITHUB_TOKEN`.
|
Beta Was this translation helpful? Give feedback.
I have figured out the answer on my own by arriving at this StackOverflow Q&A and talking to ChatGPT4.
Turns out that GitHub Actions prevents recursive workflows by design.
Here's the full response given by ChatGPT4: