Description
Describe the bug
I want to automate the creation of a PR to release a Python package with a "release_pr" workflow triggered by the push of the underlying branch, as follows (full workflow: release_pr.yml):
name: release_pr
on:
push: # When pushing a release branch
branches:
# Release branch formats:
# release_M.N.U - targets a default branch (master for M.N.0, stable_M.N otherwise)
# release_M.N.0_BRANCH - targets the specified branch
- release_*
jobs:
release_pr:
name: Create the release PR
runs-on: ubuntu-latest
steps:
. . .
- name: Create PR on Github for the pushed release branch
uses: actions/github-script@v7
with:
script: |
github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Release ${{ steps.set-version.outputs.result }}",
body: "Merging this PR will trigger the publishing to PyPI.",
head: "${{ github.ref_name }}",
base: "${{ steps.set-target-branch.outputs.result }}",
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The PR gets created successfully by this workflow, e.g.: zhmcclient/python-zhmcclient#1641
There is a second workflow "test" that is set to trigger when a PR is created. However, that second workflow is not actually triggered when the PR is created using actions/github-script (but it is triggered when manually creating a PR).
The trigger section of the "test" workflow is as follows (full workflow: test.yml)
name: test
on:
schedule:
# The schedule event always (and only) runs on the master branch.
- # cron (in UTC): minute hour day_of_month month day_of_week
cron: '00 22 * * SAT'
pull_request: # When creating a PR targeting these branches
branches:
- master
- stable_*
push: # When merging a PR targeting these branches (direct push is disabled)
branches:
- master
- stable_*
jobs:
. . .
Since the created release PR targets either the "master" or "stable_M.N" branch, the "pull_request" trigger should trigger when a PR is created through the actions/github-script code (just as it does when such a PR is created manually), but it is not actually triggered.
Do you have an idea why the "test" workflow it is not triggered through the actions/github-script code?
What is different in the way the actions/github-script code creates the PR compared to creating the PR manually, that would influence the subsequent triggering of actions?
To Reproduce
Steps to reproduce the behavior (requires push permissions to the repo):
- Clone the repo https://github.com/zhmcclient/python-zhmcclient locally
- Create a virtual Python environment using Python 3.8 or higher and have that env active
- Go to the main directory of the local repo clone
- Run "make develop" - this will install necessary Python packages
- Run "VERSION=1.18.0 make release_branch" - this will create a release branch and push that branch, which triggers the "release_pr" workflow.
- Look at the "Actions" tab to verify that the "test" workflow was not run.
Expected behavior
PR creation through the actions/github-script code should have the same Actions trigger behavior as creating a PR manually through the Github GUI.
Screenshots
N/A
Desktop (please complete the following information):
- OS: MacOS 14.6.1
- Browser: Firefox
Smartphone (please complete the following information):
N/A
Additional context
N/A