Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions .github/workflows/props-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
with:
format: 'svn'

- name: Sort props
- name: Sort props and sync the WP.org link label
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
PROPS_SORT_LAST: ${{ vars.PROPS_SORT_LAST }}
Expand Down Expand Up @@ -157,13 +157,32 @@ jobs:
);
}

if (body === propsComment.body) return;
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: propsComment.id,
body,
});
if (body !== propsComment.body) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: propsComment.id,
body,
});
}

// Keep a label in sync with whether anyone here still needs to
// link a WordPress.org account, so unlinked PRs are visible
// without opening the props comment. This is repo-specific and
// not something the upstream props-bot-action does.
const LINK_LABEL = 'Needs WP.org Link';
const needsLink = body.includes('## Unlinked Accounts');
const { owner, repo } = context.repo;
const issue_number = context.issue.number;

const { data: labels } = await github.rest.issues.listLabelsOnIssue({ owner, repo, issue_number });
const hasLabel = labels.some(l => l.name === LINK_LABEL);

if (needsLink && !hasLabel) {
await github.rest.issues.addLabels({ owner, repo, issue_number, labels: [LINK_LABEL] });
} else if (!needsLink && hasLabel) {
await github.rest.issues.removeLabel({ owner, repo, issue_number, name: LINK_LABEL });
}

- name: Remove the props-bot label
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
Expand Down
Loading