Skip to content
Snippets Groups Projects
Unverified Commit 2b25fcab authored by Ryan Laurie's avatar Ryan Laurie Committed by GitHub
Browse files

Milestone Check Perms Fix (for real this time) :sweat_smile: (#47401)

* another attempt at perms fix

* try again

* try manual graphql auth

* try with global env

* Try setting defaults in graphql

* try some more things

* use my own graphql instance

* one more test

* remove test code

* remove rogue curly brace
parent 592360c9
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ on:
jobs:
check-milestone:
permissions: write-all
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
......@@ -24,9 +25,9 @@ jobs:
run: yarn --cwd release --frozen-lockfile && yarn --cwd release build
- uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
with:
script: | # js
const {
......
import fs from "fs";
import { graphql } from "@octokit/graphql";
import _ from "underscore";
import { hiddenLabels, nonUserFacingLabels } from "./constants";
......@@ -387,7 +388,7 @@ export async function checkMilestoneForRelease({
issueNumber: issue.number,
version,
comment: 'Issue in milestone, cannot find commit',
});
}).catch((e) => console.error(`error adding issue ${issue.number} to project`, e));
}
for (const issueNumber of issuesInCommitsNotInMilestone) {
......@@ -398,7 +399,7 @@ export async function checkMilestoneForRelease({
issueNumber: issueNumber,
version,
comment: 'Issue in release branch, needs milestone',
});
}).catch((e) => console.error(`error adding issue ${issueNumber} to project`, e));
}
for (const issue of openMilestoneIssues) {
......@@ -409,7 +410,7 @@ export async function checkMilestoneForRelease({
issueNumber: issue.number,
version,
comment: 'Issue still open in milestone',
});
}).catch((e) => console.error(`error adding issue ${issue.number} to project`, e));
}
const logText = await generateLog({
......@@ -530,7 +531,7 @@ async function addIssueToProject({
comment,
version,
}: GithubProps & { issueNumber: number, comment: string, version: string }) {
console.log(`Adding issue #${issueNumber} to project`)
console.log(`Possible problem issue: #${issueNumber} - ${comment}`);
const issue = await getIssueWithCache({
github,
......@@ -544,7 +545,13 @@ async function addIssueToProject({
return;
}
const response = await github.graphql(`mutation {
const graphqlWithAuth = graphql.defaults({
headers: {
authorization: `token ${process.env.GITHUB_TOKEN}`,
},
});
const response = await graphqlWithAuth(`mutation {
addProjectV2ItemById(input: {
projectId: "${releaseIssueProject.id}",
contentId: "${issue?.node_id}"
......@@ -559,7 +566,7 @@ async function addIssueToProject({
return;
}
await github.graphql(`
await graphqlWithAuth(`
mutation {
setComment: updateProjectV2ItemFieldValue( input: {
projectId: "${releaseIssueProject.id}"
......
......@@ -334,7 +334,7 @@ export async function sendPublishCompleteMessage({
const baseMessage = `:partydeploy: *${githubRunLink(`${getGenericVersion(version)} Release is Complete`, runId.toString(), owner, repo)}* :partydeploy:`;
const fullMessage = `\n
${slackLink("EE Extra Build", `https://github.com/${owner}/metabase-ee-extra/pulls`)}}
${slackLink("EE Extra Build", `https://github.com/${owner}/metabase-ee-extra/pulls`)}
${slackLink("Ops Issues", `https://github.com/${owner}/metabase-ops/issues`)} - ${mentionSlackTeam('successengineers')}
${slackLink("Release Notes", `https://github.com/${owner}/${repo}/releases`)} - ${mentionSlackTeam('tech-writers')}
${slackLink("Docs Update", `https://github.com/${owner}/metabase.github.io/pulls`)} - ${mentionSlackTeam('tech-writers')}`;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment