github.context.payload.pull_request.title always remains the same when rerunning action.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
I am using a github action triggered by pull requests that is basically doing:
const github = require('@actions/github');
const pullRequestTitle = github.context.payload.pull_request.title;
The full code is here.
When I update the PR title after the action runs once, then rerun the action, the action reuses the old PR title! The result is that the action that is supposed to check my PR title can only be used once per commit. I have to push an empty commit to get the action to use the new PR title.
Sample runs: https://github.com/modin-project/modin/actions/runs/3231387461/jobs/5291018196
To Reproduce
Steps to reproduce the behavior:
- Add this to
.github/workflows/ci-required.ymlin some github project:
name: ci-required
on: pull_request
jobs:
check-pr-title:
runs-on: ubuntu-latest
steps:
- uses: Slashgear/action-check-pr-title@v3.0.0
with:
regexp: '^(?:FEAT|DOCS|FIX|REFACTOR|TEST|PERF)-#\d+:'
- Make a PR with valid title, e.g. TEST-#4982: Require format for PR descriptions instead of commit descriptions
- See the check-pr-title job pass, e.g. here
- change PR title so it's invalid, e.g. "TESTz-#4982: Require format for PR descriptions instead of commit descriptions"
- rerun check-pr-title job in github UI
- see check-pr-title job pass even though PR title is now invalid
- push empty commit to branch
- see check-pr-title job fail because it uses updated PR title
Expected behavior
After I update PR title and re-run Github Action, action should use updated PR title.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the @actions/github context access shown in the issue and the linked action-check-pr-title src/run.js, then reproduce the behavior using the .github/workflows/ci-required.yml workflow. Compare the pull_request.title available on the first run, a rerun, and after an empty commit; done means rerunning after a title change evaluates the updated title.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- ci-cd, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100