Skip to content

chore(ci): get pr number and sha from github context#35405

Merged
mergify[bot] merged 2 commits intoaws:mainfrom
leonmk-aws:fix_workflow
Sep 8, 2025
Merged

chore(ci): get pr number and sha from github context#35405
mergify[bot] merged 2 commits intoaws:mainfrom
leonmk-aws:fix_workflow

Conversation

@leonmk-aws
Copy link
Copy Markdown
Contributor

@leonmk-aws leonmk-aws commented Sep 3, 2025

Issue # (if applicable)

Related to #35268 as the previous fix didn't fully work

Reason for this change

The Pr linter workflow does not reach the code of the linter itself because it stop on error when being triggered at the end of a build, see the following run for example.

Description of changes

Continue if 'Download workflow_run artifact' to get the PR number and the pr sha from the Github context.

Description of how you validated changes

Ran on my fork of the repo (canceling the build workflow retriggers this one), see the following run for example: https://github.com/leonmk-aws/aws-cdk/actions/runs/17435786087/job/49505111010

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the p2 label Sep 3, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team September 3, 2025 13:44
@leonmk-aws leonmk-aws changed the title chore: get pr number and sha from github context chore(ci): get pr number and sha from github context Sep 3, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 3, 2025
@leonmk-aws leonmk-aws marked this pull request as ready for review September 3, 2025 14:27
run: |
if [[ ! -f pr/pr_number ]]; then
echo "${{ github.event.pull_request.number }}" > pr/pr_number
echo "${{ github.event.workflow_run.pull_requests[0].number }}" > pr/pr_number
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This operation feels unsafe to me. What happens if the element I am trying to access do not exist?

Copy link
Copy Markdown
Contributor Author

@leonmk-aws leonmk-aws Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It resolves to echo "" > pr/pr_number, see this run: https://github.com/leonmk-aws/aws-cdk/actions/runs/17497346723/ (if you look at the workflow file I tried to workflow_run.pull_requests[10] which doesn't exist)

@ozelalisen ozelalisen self-assigned this Sep 3, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Sep 3, 2025
@leonmk-aws leonmk-aws added pr/do-not-merge This PR should not be merged at this time. and removed pr/do-not-merge This PR should not be merged at this time. labels Sep 5, 2025
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 8, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 8, 2025

This pull request has been removed from the queue for the following reason: pull request branch update failed.

The pull request can't be updated.

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

@ozelalisen
Copy link
Copy Markdown
Member

@Mergifyio update

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 8, 2025

update

❌ Mergify doesn't have permission to update

Details

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/codeql.yml without workflows permission

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 8, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 422e864 into aws:main Sep 8, 2025
19 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 8, 2025

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants