Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix PR labels parsing in update label workflow #30507

Merged

Conversation

pippolo84
Copy link
Member

github.event.pull_request.labels contains an array of objects that describe various attributes of each label attached to the PR.

An example is the following from the GitHub docs:

"labels": [
  {
    "id": 208045946,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "description": "Something isn't working",
    "color": "f29513",
    "default": true
  }
]

(see
https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request)

Being a JSON object, we cannot collect all the names of the labels in a list with a '*' wildcard. Instead, the commit fixes the workflow first copying the labels JSON array in an env variable and then using jq to get all the labels names.

Fixes: 7fc78e9 ("ci: Add a call to the update label backport action")

Once backported to v1.15, this should fix errors in the workflow like this one: https://github.com/cilium/cilium/actions/runs/7637627812

github.event.pull_request.labels contains an array of objects that
describe various attributes of each label attached to the PR.

An example is the following from the GitHub docs:

"labels": [
  {
    "id": 208045946,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "description": "Something isn't working",
    "color": "f29513",
    "default": true
  }
]

(see
https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request)

Being a JSON object, we cannot collect all the names of the labels in a
list with a '*' wildcard. Instead, the commit fixes the workflow first
copying the labels JSON array in an env variable and then using jq to
get all the labels names.

Fixes: 7fc78e9 ("ci: Add a call to the update label backport action")

Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
@pippolo84 pippolo84 added kind/bug/CI This is a bug in the testing code. release-note/ci This PR makes changes to the CI. needs-backport/1.15 This PR / issue needs backporting to the v1.15 branch labels Jan 29, 2024
@pippolo84 pippolo84 requested review from a team as code owners January 29, 2024 14:37
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in v1.15.0-rc.1 Jan 29, 2024
@pippolo84
Copy link
Member Author

/cc @giorio94

@pippolo84
Copy link
Member Author

Tested in a mock repository (example run triggered by a 1.14 fake backport): https://github.com/pippolo84/gh-action-label-test/actions/runs/7697376760)

@aanm aanm merged commit deecf2e into cilium:main Jan 31, 2024
45 checks passed
@aanm aanm added this to Needs backport from main in 1.15.1 Jan 31, 2024
@aanm aanm removed this from Needs backport from main in v1.15.0-rc.1 Jan 31, 2024
@nbusseneau nbusseneau mentioned this pull request Feb 8, 2024
12 tasks
@nbusseneau nbusseneau added backport-pending/1.15 The backport for Cilium 1.15.x for this PR is in progress. and removed needs-backport/1.15 This PR / issue needs backporting to the v1.15 branch labels Feb 8, 2024
@github-actions github-actions bot added backport-done/1.15 The backport for Cilium 1.15.x for this PR is done. and removed backport-pending/1.15 The backport for Cilium 1.15.x for this PR is in progress. labels Feb 9, 2024
@michi-covalent michi-covalent moved this from Needs backport from main to Backport done to v1.15 in 1.15.1 Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.15 The backport for Cilium 1.15.x for this PR is done. kind/bug/CI This is a bug in the testing code. release-note/ci This PR makes changes to the CI.
Projects
No open projects
1.15.1
Backport done to v1.15
Development

Successfully merging this pull request may close these issues.

None yet

4 participants