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

Show "Disabled" state in github-actions-indicators #6543

Conversation

134130
Copy link
Contributor

@134130 134130 commented Apr 20, 2023

Test URLs

https://github.com/134130/134130/actions

Screenshot

image

image

@fregante fregante changed the title Add "Disable" icon to github-actions-indicators #6529 Add "Disable" icon to github-actions-indicators Apr 21, 2023
@fregante fregante changed the title Add "Disable" icon to github-actions-indicators Add "Disabled" icon to github-actions-indicators Apr 21, 2023
@fregante fregante changed the title Add "Disabled" icon to github-actions-indicators Show "Disabled" state in github-actions-indicators Apr 21, 2023
Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

Thank you for the changes!

source/features/github-actions-indicators.tsx Outdated Show resolved Hide resolved
source/features/github-actions-indicators.tsx Outdated Show resolved Hide resolved
source/features/github-actions-indicators.tsx Outdated Show resolved Hide resolved
Comment on lines 44 to 45
// Note: The response is not reliable.
// Some workflow's path is '' and deleted workflow's state is 'active'.
Copy link
Member

Choose a reason for hiding this comment

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

When does this happen? Is it just an empty string is or it just a consequence of .split().pop()

Also the state of deleted workflows is consistent/correct.

Suggested change
// Note: The response is not reliable.
// Some workflow's path is '' and deleted workflow's state is 'active'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can check these bugs with calling API of getting refined-github/refined-github's workflow list.

# GET /repos/refined-github/refined-github/actions/workflows
curl -i -H "Authorization: token YOUR_TOKEN" https://api.github.com/repos/refined-github/refined-github/actions/workflows

Here is the query result for saving your time :)

[
    {
        "id": 178729,
        "node_id": "MDg6V29ya2Zsb3cxNzg3Mjk=",
        "name": "Test",
        "path": "",
        "state": "active",
        "created_at": "2020-01-10T06:49:42.000+09:00",
        "updated_at": "2020-01-11T01:03:31.000+09:00",
        "url": "https://api.github.com/repos/refined-github/refined-github/actions/workflows/178729",
        "html_url": "https://github.com/refined-github/refined-github/blob/main",
        "badge_url": "https://github.com/refined-github/refined-github/workflows/Test/badge.svg"
    },
    {
        "id": 49251289,
        "node_id": "W_kwDOAxXxWc4C74PZ",
        "name": "actionlint",
        "path": ".github/workflows/actionlint.yml",
        "state": "active",
        "created_at": "2023-02-23T19:04:16.000+09:00",
        "updated_at": "2023-03-01T18:24:51.000+09:00",
        "url": "https://api.github.com/repos/refined-github/refined-github/actions/workflows/49251289",
        "html_url": "https://github.com/refined-github/refined-github/blob/main/.github/workflows/actionlint.yml",
        "badge_url": "https://github.com/refined-github/refined-github/workflows/actionlint/badge.svg"
    },
    {
        "id": 11449857,
        "node_id": "MDg6V29ya2Zsb3cxMTQ0OTg1Nw==",
        "name": "CodeQL",
        "path": ".github/workflows/codeql-analysis.yml",
        "state": "active",
        "created_at": "2021-07-20T16:08:53.000+09:00",
        "updated_at": "2021-07-20T16:08:53.000+09:00",
        "url": "https://api.github.com/repos/refined-github/refined-github/actions/workflows/11449857",
        "html_url": "https://github.com/refined-github/refined-github/blob/main/.github/workflows/codeql-analysis.yml",
        "badge_url": "https://github.com/refined-github/refined-github/workflows/CodeQL/badge.svg"
    },
    {
        "id": 10572899,
        "node_id": "MDg6V29ya2Zsb3cxMDU3Mjg5OQ==",
        "name": "Features",
        "path": ".github/workflows/features.yml",
        "state": "active",
        "created_at": "2021-06-19T14:56:34.000+09:00",
        "updated_at": "2021-08-24T22:46:39.000+09:00",
        "url": "https://api.github.com/repos/refined-github/refined-github/actions/workflows/10572899",
        "html_url": "https://github.com/refined-github/refined-github/blob/main/.github/workflows/features.yml",
        "badge_url": "https://github.com/refined-github/refined-github/workflows/Features/badge.svg"
    },
    {
        "id": 2844040,
        "node_id": "MDg6V29ya2Zsb3cyODQ0MDQw",
        "name": "Labeler",
        "path": ".github/workflows/labeler.yml",
        "state": "active",
        "created_at": "2020-10-04T14:49:14.000+09:00",
        "updated_at": "2020-10-04T14:49:14.000+09:00",
        "url": "https://api.github.com/repos/refined-github/refined-github/actions/workflows/2844040",
        "html_url": "https://github.com/refined-github/refined-github/blob/main/.github/workflows/labeler.yml",
        "badge_url": "https://github.com/refined-github/refined-github/workflows/Labeler/badge.svg"
    },
    {
        "id": 10549616,
        "node_id": "MDg6V29ya2Zsb3cxMDU0OTYxNg==",
        "name": "New feature",
        "path": ".github/workflows/new-feature-checker.yml",
        "state": "active",
        "created_at": "2021-06-18T19:18:44.000+09:00",
        "updated_at": "2021-06-18T20:31:13.000+09:00",
        "url": "https://api.github.com/repos/refined-github/refined-github/actions/workflows/10549616",
        "html_url": "https://github.com/refined-github/refined-github/blob/main/.github/workflows/new-feature-checker.yml",
        "badge_url": "https://github.com/refined-github/refined-github/workflows/New%20feature/badge.svg"
    },
    {
        "id": 3562699,
        "node_id": "MDg6V29ya2Zsb3czNTYyNjk5",
        "name": "Release",
        "path": ".github/workflows/release.yml",
        "state": "active",
        "created_at": "2020-11-12T14:56:40.000+09:00",
        "updated_at": "2022-07-07T22:21:40.000+09:00",
        "url": "https://api.github.com/repos/refined-github/refined-github/actions/workflows/3562699",
        "html_url": "https://github.com/refined-github/refined-github/blob/main/.github/workflows/release.yml",
        "badge_url": "https://github.com/refined-github/refined-github/workflows/Release/badge.svg"
    },
    {
        "id": 4737,
        "node_id": "MDg6V29ya2Zsb3c0NzM3",
        "name": "Test",
        "path": ".github/workflows/test.yml",
        "state": "active",
        "created_at": "2019-12-19T10:57:00.000+09:00",
        "updated_at": "2019-12-19T10:57:00.000+09:00",
        "url": "https://api.github.com/repos/refined-github/refined-github/actions/workflows/4737",
        "html_url": "https://github.com/refined-github/refined-github/blob/main/.github/workflows/test.yml",
        "badge_url": "https://github.com/refined-github/refined-github/workflows/Test/badge.svg"
    }
]
  • API response returns some workflow's path value to empty string.
    • The 0th of array which name is "Test" is that.
  • The deleted workflow's state should be 'deleted' but 'active' is coming.
    • .github/workflows/new-feature-checker.yml is deleted workflow.
"state": {
  "type": "string",
  "enum": [
    "active",
    "deleted",
    "disabled_fork",
    "disabled_inactivity",
    "disabled_manually"
  ],
  "examples": [
    "active"
  ]
},

I've created GitHub Issue ticket.

source/features/github-actions-indicators.tsx Outdated Show resolved Hide resolved
if (!workflows) {
return; // Impossibru, for types only
}

if (select.exists('.octicon-stop', workflowListItem)) {
Copy link
Member

Choose a reason for hiding this comment

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

It turns out GitHub already had this indicator before, we were event skipping items that had it: https://docs.github.com/en/enterprise-server@3.4/actions/managing-workflow-runs/disabling-and-enabling-a-workflow

actions-find-disabled-workflow

For this reason I replaced the Alert icon with a Stop icon

Suggested change
if (select.exists('.octicon-stop', workflowListItem)) {
// There might be a disabled indicator already
if (select.exists('.octicon-stop', workflowListItem)) {

@fregante fregante enabled auto-merge (squash) April 25, 2023 06:19
@fregante fregante merged commit 9d80ba2 into refined-github:main Apr 25, 2023
@fregante
Copy link
Member

Thank you for your contributions!

@134130 134130 deleted the feature/github-actions-indicators/disable-icon branch April 25, 2023 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Add "Disable" icon to github-actions-indicators
2 participants