<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Padraic Gilbert</title>
    <description>The latest articles on DEV Community by Padraic Gilbert (@padraic_73a7e86bfc).</description>
    <link>https://dev.to/padraic_73a7e86bfc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4274873%2Fff76d143-cb14-48fa-8bdf-55fe7a506088.png</url>
      <title>DEV Community: Padraic Gilbert</title>
      <link>https://dev.to/padraic_73a7e86bfc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/padraic_73a7e86bfc"/>
    <language>en</language>
    <item>
      <title>From a website form to an Azure Boards card and back: building a suggestion loop with GitHub Actions</title>
      <dc:creator>Padraic Gilbert</dc:creator>
      <pubDate>Mon, 30 Nov 2026 17:59:34 +0000</pubDate>
      <link>https://dev.to/padraic_73a7e86bfc/from-a-website-form-to-an-azure-boards-card-and-back-building-a-suggestion-loop-with-github-actions-4e8f</link>
      <guid>https://dev.to/padraic_73a7e86bfc/from-a-website-form-to-an-azure-boards-card-and-back-building-a-suggestion-loop-with-github-actions-4e8f</guid>
      <description>&lt;p&gt;tags: azure, githubactions, devops, ai&lt;/p&gt;

&lt;p&gt;From a website form to an Azure Boards card and back&lt;br&gt;
Tech Mapper is a public map of who's who in AI: who builds what, who competes with whom, and which problems they are trying to solve. A map like that is never finished, so we wanted visitors to tell us what's missing. This post walks through the loop we built for that, end to end:&lt;br&gt;
A visitor fills in Suggest a company or feature on the site.&lt;br&gt;
The site files a GitHub issue.&lt;br&gt;
A GitHub Actions workflow creates an Azure Boards card and comments &lt;code&gt;Tracked as AB#n&lt;/code&gt; on the issue.&lt;br&gt;
We review the request, then either open a pull request that says &lt;code&gt;Fixes AB#n&lt;/code&gt;, or decline it with a comment.&lt;br&gt;
Closing the issue moves the card to Done.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why this matters
This section is for business owners. Engineers can skip to section 2.
Most "contact us" and feedback forms are a black hole. Suggestions land in an inbox, nobody owns them, and the person who wrote in never hears back. This loop fixes that in four ways.
Every suggestion is captured. Each one becomes a tracked item automatically. Nothing depends on someone remembering to copy an email into a to-do list.
Every suggestion is answered. A request is only closed when someone adds what was asked for or explains why not. Our first real suggestion was declined, and the reply explained why and suggested what to ask for instead.
AI does the first review, and people stay in control. An AI assistant reads the request, checks it against what is already on the map, and drafts either the change or the reply. A person approves every change and every answer before it goes out. Nothing is added to the site or posted publicly without that sign-off.
One board for status. Managers see every open request on an Azure Boards board next to the rest of the work, without needing to look in GitHub. The board updates itself when work is finished.
The result is a feedback channel that costs very little to run, scales with traffic, and makes visitors feel heard.&lt;/li&gt;
&lt;li&gt;Architecture at a glance
From here on, the post is for engineers.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Visitor
     │  "Suggest a company or feature"
     ▼
┌──────────────────────────┐
│  Static site (SWA)       │  site/suggest.js
│  POST /api/request       │
└────────────┬─────────────┘
             ▼
┌──────────────────────────┐   app setting GITHUB_TOKEN
│  Managed Azure Function  │   (fine-grained, Issues: R/W)
│  validates + files issue │
└────────────┬─────────────┘
             ▼
┌──────────────────────────┐  issues: opened / closed / reopened
│  GitHub issue            │ ─────────────────────────────┐
│  (source of truth)       │                              ▼
│                          │              ┌───────────────────────────────┐
│  "Tracked as AB#n"  ◄────┼──────────────│ .github/workflows/            │
└────────────┬─────────────┘   comment    │   boards-sync.yml             │
             │                            │ (Azure DevOps REST, PAT)      │
             │ review                     └───────────────┬───────────────┘
             ▼                                            ▼
   ┌────────────────────┐                   ┌───────────────────────────┐
   │ PR: "Fixes #n"     │                   │ Azure Boards work item     │
   │     "Fixes AB#n"   │── merge closes ──►│ New ──► Done               │
   │ or decline+close   │     the issue     │ (PR linked by Boards app)  │
   └────────────────────┘                   └───────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Two design choices drive everything else:&lt;br&gt;
GitHub is the source of truth. The issue holds the conversation, the decision and the history. Boards is a mirror for status.&lt;br&gt;
The sync is one-way and state-only. The workflow creates the card, then moves it between active and done. It never copies comments, and it never reads anything back from Boards.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Step by step
3.1 The form and the function
The site is an Azure Static Web App on the Free plan. The form posts JSON to &lt;code&gt;/api/request&lt;/code&gt;, a managed function that the Free plan includes. The function validates the request and files the issue with the GitHub REST API:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// api/src/lib/request.js (trimmed)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createIssue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;issue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;repo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fetchImpl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;post&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;fetchImpl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`https://api.github.com/repos/${repo}/issues`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'POST'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nc"&gt;Accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'application/vnd.github+json'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nc"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`Bearer ${token}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'Content-Type'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'application/json'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'X-GitHub-Api-Version'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2022-11-28'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;issue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// Labels missing and the token can't create them? Retry without, so the request still lands.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;422&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;issue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;issue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;issue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;A public form that writes to your repo needs some care:&lt;br&gt;
Spam: a hidden honeypot field, a minimum of 3 seconds between opening and submitting, length limits on every field, and 5 requests per hour per visitor address.&lt;br&gt;
Untrusted text: the visitor's words are quoted, and &lt;code&gt;@mentions&lt;/code&gt;, &lt;code&gt;#123&lt;/code&gt; references and HTML are neutralized, so a request can't ping people or link other issues.&lt;br&gt;
Privacy: no name, email or IP address is stored. The issue says it was submitted anonymously and is unverified.&lt;br&gt;
Graceful fallback: if the function has no token or GitHub is down, the form offers a prefilled "new issue" link instead.&lt;br&gt;
Issues get a consistent title (&lt;code&gt;Company request: &amp;lt;name&amp;gt;&lt;/code&gt; or &lt;code&gt;Feature request: &amp;lt;title&amp;gt;&lt;/code&gt;) and a label (&lt;code&gt;company-request&lt;/code&gt; or &lt;code&gt;feature-request&lt;/code&gt;). The workflow uses both later.&lt;br&gt;
3.2 Azure DevOps organization and project&lt;br&gt;
If you don't have one yet, create an Azure DevOps organization at &lt;code&gt;dev.azure.com&lt;/code&gt;, then a project inside it. Any process template works (Basic, Agile, Scrum or CMMI). The workflow detects which one you picked.&lt;br&gt;
In the rest of this post, &lt;code&gt;&amp;lt;your-org&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;your-project&amp;gt;&lt;/code&gt; stand for those names.&lt;br&gt;
3.3 A scoped personal access token&lt;br&gt;
In Azure DevOps, go to User settings &amp;gt; Personal access tokens &amp;gt; New token:&lt;br&gt;
Organization: only &lt;code&gt;&amp;lt;your-org&amp;gt;&lt;/code&gt;.&lt;br&gt;
Scopes: Custom defined, then Work Items: Read &amp;amp; write. Nothing else.&lt;br&gt;
Expiration: short. We picked about 60 days and put the renewal date in our docs.&lt;br&gt;
If this token leaks, the worst it can do is edit work items in one org. It can't touch code, pipelines or other projects.&lt;br&gt;
3.4 The GitHub repository secret&lt;br&gt;
In the GitHub repository, go to Settings &amp;gt; Secrets and variables &amp;gt; Actions &amp;gt; Repository secrets &amp;gt; New repository secret and paste the token. In this post we call it &lt;code&gt;BOARDS_SYNC_PAT&lt;/code&gt;.&lt;br&gt;
Two things to check:&lt;br&gt;
It must be an Actions repository secret (or an organization secret shared with the repo). Environment, Codespaces and Dependabot secrets are separate stores, and this workflow can't see them.&lt;br&gt;
The name must match the workflow exactly, letter for letter. More on that in the gotchas.&lt;br&gt;
Optional repository variables (same page, Variables tab) let you override the org, project, work item type and states without editing YAML.&lt;br&gt;
3.5 The workflow&lt;br&gt;
The whole sync is a single &lt;code&gt;actions/github-script&lt;/code&gt; step, with no third-party actions. Here are the key parts of &lt;code&gt;.github/workflows/boards-sync.yml&lt;/code&gt;.&lt;br&gt;
Trigger, permissions and concurrency. The workflow only needs to comment on issues. One run per issue at a time means a quick open-then-close can't race.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Boards sync&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;opened&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;reopened&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;closed&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;

&lt;span class="na"&gt;concurrency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;boards-sync-${{ github.event.issue.number }}&lt;/span&gt;
  &lt;span class="na"&gt;cancel-in-progress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only request issues. The fallback link can't apply labels for people without triage access, so the filter also matches the title prefix and the form's footer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;sync&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;
      &lt;span class="s"&gt;contains(github.event.issue.labels.*.name, 'company-request') ||&lt;/span&gt;
      &lt;span class="s"&gt;contains(github.event.issue.labels.*.name, 'feature-request') ||&lt;/span&gt;
      &lt;span class="s"&gt;startsWith(github.event.issue.title, 'Company request:') ||&lt;/span&gt;
      &lt;span class="s"&gt;startsWith(github.event.issue.title, 'Feature request:') ||&lt;/span&gt;
      &lt;span class="s"&gt;contains(github.event.issue.body, 'from the site''s Suggest form')&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;timeout-minutes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Sync issue to Azure Boards&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/github-script@v8&lt;/span&gt;
        &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;AZDO_PAT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.BOARDS_SYNC_PAT }}&lt;/span&gt;
          &lt;span class="na"&gt;AZDO_ORG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.AZDO_ORG || '&amp;lt;your-org&amp;gt;' }}&lt;/span&gt;
          &lt;span class="na"&gt;AZDO_PROJECT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.AZDO_PROJECT || '&amp;lt;your-project&amp;gt;' }}&lt;/span&gt;
          &lt;span class="na"&gt;AZDO_WORK_ITEM_TYPE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.AZDO_WORK_ITEM_TYPE }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fail loudly, and never log the token. Azure DevOps takes a PAT as Basic auth with an empty username. The secret is masked by Actions automatically, but the base64 form isn't, so mask that too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;pat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;AZDO_PAT&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;pat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// A green run here would hide that nothing reached Boards.&lt;/span&gt;
  &lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setFailed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'The BOARDS_SYNC_PAT secret is empty in this run, so nothing was synced to Azure Boards. '&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="s1"&gt;'Add it under Settings &amp;gt; Secrets and variables &amp;gt; Actions &amp;gt; Repository secrets.'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`:${pat}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'base64'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setSecret&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Treat a sign-in page as a failure. A bad or expired PAT often gets an HTTP 203 with the HTML sign-in page, not a 401. If you only check &lt;code&gt;res.ok&lt;/code&gt;, you'll try to parse HTML as JSON and get a confusing error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'content-type'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;401&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;203&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'json'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Azure DevOps rejected the token (HTTP ${res.status}). Check that it hasn't expired.`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Detect the work item type and states so the same workflow runs against any process template. It picks &lt;code&gt;User Story&lt;/code&gt; (Agile), else &lt;code&gt;Issue&lt;/code&gt; (Basic, CMMI), else &lt;code&gt;Product Backlog Item&lt;/code&gt; (Scrum). It maps "done" and "active" through Azure's state categories rather than hard-coded names.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;devops&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`_apis/wit/workitemtypes/${encodeURIComponent(type)}/states`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;byCategory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;closing&lt;/span&gt;
  &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nf"&gt;byCategory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Completed'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                              &lt;span class="c1"&gt;// Closed (Agile), Done (Basic)&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;byCategory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'InProgress'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nf"&gt;byCategory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Proposed'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// Active (Agile), Doing (Basic)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the card with a JSON Patch document: title, HTML-escaped body, a link back to the issue, and tags.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;wi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;devops&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`_apis/wit/workitems/$${encodeURIComponent(type)}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'POST'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;contentType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'application/json-patch+json'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'add'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/fields/System.Title'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;issue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'add'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/fields/System.Description'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;description&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'add'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/fields/System.Tags'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;// "github; company-request"&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'add'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/relations/-'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;rel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Hyperlink'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;issueUrl&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;issues&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createComment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;repo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;issue_number&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;issue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`Tracked as AB#${wi.id} ([open in Azure Boards](${cardUrl(wi.id)})).`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find the card again on close or reopen. The workflow's own comment is the primary key. It only trusts comments from &lt;code&gt;github-actions[bot]&lt;/code&gt;, so a visitor can't comment &lt;code&gt;Tracked as AB#999&lt;/code&gt; and point the sync at someone else's card. As a backup, for example when a run created the card but died before commenting, it runs a WIQL search and confirms each hit by its hyperlink to the issue.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;login&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'github-actions[bot]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nc"&gt;Tracked&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="no"&gt;AB&lt;/span&gt;#&lt;span class="p"&gt;(&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Move the state with an optimistic-concurrency check. The &lt;code&gt;test&lt;/code&gt; on &lt;code&gt;/rev&lt;/code&gt; makes the update fail rather than overwrite a change someone made on the board at the same moment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;devops&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`_apis/wit/workitems/${card.id}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'PATCH'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;contentType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'application/json-patch+json'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'test'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/rev'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;wi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rev&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'add'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/fields/System.State'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'add'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/fields/System.History'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`GitHub issue ${issueRef} was ${action}.`&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reopening an issue that never got a card creates one. That gives you an easy backfill for issues filed while the sync was broken: close them, then reopen them.&lt;br&gt;
3.6 Install the Azure Boards app for GitHub&lt;br&gt;
The workflow handles create and state. The Azure Boards app for GitHub is what turns &lt;code&gt;AB#n&lt;/code&gt; in a PR or commit into a link on the card.&lt;br&gt;
In Azure DevOps, open Project settings &amp;gt; Boards &amp;gt; GitHub connections &amp;gt; Connect your GitHub account. You can also install Azure Boards from the GitHub Marketplace.&lt;br&gt;
When GitHub asks where to install, pick Only select repositories and choose the one repo. The app doesn't need access to anything else.&lt;br&gt;
Make sure you connect it to your existing organization and project. See the gotcha below.&lt;br&gt;
With that in place, a PR description like this links the PR on the card:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Adds Acme AI to the map.

Fixes #42
Fixes AB#17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Fixes #42&lt;/code&gt; closes the GitHub issue on merge, which fires the workflow and moves the card to Done. &lt;code&gt;Fixes AB#17&lt;/code&gt; links the PR on the card. We include both on every PR that resolves a request.&lt;br&gt;
3.7 The Static Web App &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; setting&lt;br&gt;
The function needs a token to file issues. Create a fine-grained GitHub token:&lt;br&gt;
Repository access: Only select repositories, then the one repo.&lt;br&gt;
Permissions: Issues: Read and write. Nothing else.&lt;br&gt;
Expiry: pick a date and write it down. When it expires, the form quietly falls back to the "new issue" link.&lt;br&gt;
Then give it to the Static Web App as an app setting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;az staticwebapp appsettings &lt;span class="nb"&gt;set&lt;/span&gt; \
  --name &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;your-static-web-app&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --resource-group &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;your-resource-group&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; \
  --setting-names &lt;span class="nv"&gt;GITHUB_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&amp;lt;&lt;/span&gt;token&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or use the portal: Static Web App &amp;gt; Settings &amp;gt; Environment variables &amp;gt; Production &amp;gt; Add. App settings take effect without a redeploy.&lt;br&gt;
Note that this &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; is an app setting you create yourself. It is not the automatic &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; that GitHub Actions gives each workflow run, which the sync workflow uses for its comments.&lt;br&gt;
3.8 Test with a real suggestion&lt;br&gt;
Our first real test was a genuine suggestion sent through the form, asking whether we could add "Crispr":&lt;br&gt;
The form filed &lt;code&gt;Company request: Can we add Crispr?&lt;/code&gt; with the &lt;code&gt;company-request&lt;/code&gt; label.&lt;br&gt;
Once the secret fix below was in, the workflow created AB#1 and commented &lt;code&gt;Tracked as AB#1&lt;/code&gt; on the issue.&lt;br&gt;
An AI assistant did the first review. CRISPR is a gene-editing technique, not a company, and it isn't an AI technology. The assistant drafted a reply that explained this and suggested asking for an AI-for-biology company instead.&lt;br&gt;
We approved the reply, posted it, and closed the issue as not planned.&lt;br&gt;
The workflow moved AB#1 to Done.&lt;br&gt;
A declined request still gets an answer and a closed card. That's the point.&lt;br&gt;
If you want to test it yourself before going live, open an issue with the &lt;code&gt;feature-request&lt;/code&gt; label, check for the card and the comment, close and reopen it, then delete the test card.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Gotchas we hit
The secret name mismatch: a green run that did nothing
Our first run went green and created no card. The workflow read &lt;code&gt;secrets.BOARDSYNC_PAT&lt;/code&gt;, but the secret was saved as &lt;code&gt;BOARDSSYNC_PAT&lt;/code&gt;, with a double S. When a secret doesn't exist, GitHub Actions doesn't error. The expression evaluates to an empty string. Our first version treated an empty token as "not configured yet" and only logged a warning, so the run passed.
The fix (PR #15) did two things:
It renamed the reference to match the secret that actually existed.
It made a missing secret fail the run, with a message that says where the secret must live.
The lesson: if a step can't do its job without a secret, fail when the secret is empty. A green check that did nothing is worse than a red one.
Connect the Boards app to your existing organization
When we installed the Azure Boards app from GitHub, the flow landed on a form to create a new Azure DevOps organization. That form isn't what you want if you already have an org and project. Fill it in and you get a second, empty org, and &lt;code&gt;AB#&lt;/code&gt; links from your repo won't resolve to your cards. Go back and start from Project settings &amp;gt; GitHub connections in your existing project instead, or sign in with the account that owns the existing org, so the connection is made there.
Don't enable two paths to Boards
The function has its own optional Azure Boards path. If &lt;code&gt;DEVOPS_ORG&lt;/code&gt;, &lt;code&gt;DEVOPS_PROJECT&lt;/code&gt; and &lt;code&gt;DEVOPS_PAT&lt;/code&gt; are set as app settings, it creates a work item directly when the form is submitted. That came first. The workflow came later and does the same job from the GitHub side.
Turn on both and every request gets two cards: one from the function, tagged &lt;code&gt;from-site&lt;/code&gt;, and one from the workflow, tagged &lt;code&gt;github&lt;/code&gt;. Pick one. We picked the workflow, because it also handles close and reopen, and it works for issues filed by hand or through the fallback link.
The sync mirrors state, not comments
The card gets the issue's title, body and a link when it is created. After that, only the state changes. Comments, edits and labels on the issue don't flow to the card, and nothing on the card flows back.
That's deliberate. Two-way sync of conversations is where integrations get messy. Keeping GitHub as the single source of truth means:
Discussion with the requester happens on the issue, in public.
The card is for status and planning. If you need context, follow its link to the issue.
Closing or reopening the card on the board doesn't change the issue. Close the issue instead, and let the workflow move the card.&lt;/li&gt;
&lt;li&gt;What's next
PAT renewal. The Azure DevOps token is deliberately short-lived. When it expires, runs fail with "Azure DevOps rejected the token" and nothing syncs. The renewal date is in our docs. Issues filed in the gap can be backfilled by closing and reopening them. A scheduled workflow that warns a couple of weeks before expiry would be a nice addition. Longer term, workload identity federation with a service principal would remove the PAT altogether.
Move the deploy pipeline from &lt;code&gt;NodeTool@0&lt;/code&gt; to &lt;code&gt;UseNode@1&lt;/code&gt;. Our Azure Pipelines build still installs Node with the older &lt;code&gt;NodeTool@0&lt;/code&gt; task. &lt;code&gt;UseNode@1&lt;/code&gt; is its replacement, and the change is small:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;  &lt;span class="c1"&gt;# before
&lt;/span&gt;  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;NodeTool@0&lt;/span&gt;
    &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;versionSpec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$(nodeVersion)&lt;/span&gt;

  &lt;span class="c1"&gt;# after
&lt;/span&gt;  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;UseNode@1&lt;/span&gt;
    &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$(nodeVersion)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ideas to extend it:&lt;br&gt;
Post a short summary to Teams or Slack when a card is created.&lt;br&gt;
Copy the decision (added or declined, and why) onto the card when the issue closes, so the board tells the whole story without a click.&lt;br&gt;
Add a CAPTCHA such as Cloudflare Turnstile to the form if spam picks up.&lt;br&gt;
Let the AI first review attach a draft PR directly to the issue, so the person reviewing only has to approve or edit it.&lt;br&gt;
The pieces are small: one function, one workflow, one token with one scope. Together they turn a feedback form into a loop where every suggestion gets tracked, reviewed and answered.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>azure</category>
      <category>devops</category>
      <category>githubactions</category>
    </item>
  </channel>
</rss>
