message: Restore `scheduled-and-manual-workflow-indicators`
diff: @@ -15,6 +15,16 @@ type WorkflowDetails = {
  manuallyDispatchable: boolean;
  };
  +function addTooltip(element: HTMLElement, tooltip: string): void {
  + const existingTooltip = element.getAttribute('aria-label');
  + if (existingTooltip) {
  + element.setAttribute('aria-label', existingTooltip + '.\n' + tooltip);
  + } else {
  + element.classList.add('tooltipped', 'tooltipped-s');
  + element.setAttribute('aria-label', tooltip);
  + }
  +}
  +
  const getWorkflowsDetails = cache.function(async (): Promise<Record<string, WorkflowDetails> | false> => {
  const {repository: {workflowFiles}} = await api.v4(`
  repository() {
  @@ -61,8 +71,8 @@ async function init(): Promise<false | void> {
  return false;
  }
  - const workflowsSidebar = await elementReady('.Layout-sidebar');
  - for (const workflowListItem of select.all('a.filter-item[href*="/workflows/"]', workflowsSidebar)) {
  + const workflowsSidebar = await elementReady('.ActionList');
  + for (const workflowListItem of select.all('a.ActionList-content[href*="/workflows/"]', workflowsSidebar)) {
  if (select.exists('.octicon-stop', workflowListItem)) {
  continue;
  }
  @@ -73,12 +83,9 @@ async function init(): Promise<false | void> {
  continue;
  }
  - const tooltip: string[] = [];
  if (workflow.manuallyDispatchable) {
  - workflowListItem.append(<PlayIcon className="ml-1"/>);
  - tooltip.push('This workflow can be triggered manually');
  - workflowListItem.parentElement!.classList.add('tooltipped', 'tooltipped-e');
  - workflowListItem.parentElement!.setAttribute('aria-label', tooltip.join('\n'));
  + workflowListItem.append(<PlayIcon className="ActionListItem-visual--trailing m-auto"/>);
  + addTooltip(workflowListItem, 'This workflow can be triggered manually');
  }
  if (workflow.schedule) {
  @@ -87,16 +94,15 @@ async function init(): Promise<false | void> {
  continue;
  }
  - const relativeTime = <relative-time datetime={nextTime.toString()}/>;
  - workflowListItem.append(
  - <em className={workflow.manuallyDispatchable ? 'ml-2' : ''}>
  + const relativeTime = <relative-time datetime={String(nextTime)}/>;
  + select('.ActionList-item-label', workflowListItem)!.append(
  + <em>
  (next {relativeTime})
  </em>,
  );
  - setTimeout(() => { // The content of `relative-time` might not be immediately available
  - tooltip.push('Next ' + relativeTime.textContent!);
  - workflowListItem.parentElement!.classList.add('tooltipped', 'tooltipped-e');
  - workflowListItem.parentElement!.setAttribute('aria-label', tooltip.join('\n'));
  + setTimeout(() => {
  + // The content of `relative-time` might not be immediately available
  + addTooltip(workflowListItem, 'Next run in ' + relativeTime.textContent!);
  }, 500);
  }
  }
  @@ -110,3 +116,15 @@ void features.add(import.meta.url, {
  deduplicate: 'has-rgh-inner',
  init,
  });
  +
  +/*
  +
  +## Test URLs
  +
  +Manual:
  +https://github.com/fregante/browser-extension-template/actions
  +
  +Manual + scheduled:
  +https://github.com/fregante/eslint-formatters/actions
  +
  +*/
  