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

feat: make add-team-label use the reusable workflow #10350

Merged
merged 7 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ async function main(): Promise<void> {
// We can't use "GITHUB_TOKEN" here, as its permissions are scoped to the repository where the action is running.
// "GITHUB_TOKEN" does not have access to other repositories, even when they belong to the same organization.
// As we want to get files which are not necessarily located in the same repository,
// we need to create our own "RELEASE_LABEL_TOKEN" with "repo" permissions.
// we need to create our own "PERSONAL_ACCESS_TOKEN" with "repo" permissions.
// Such a token allows to access other repositories of the MetaMask organisation.
const personalAccessToken = process.env.RELEASE_LABEL_TOKEN;
const personalAccessToken = process.env.PERSONAL_ACCESS_TOKEN;
if (!personalAccessToken) {
core.setFailed('RELEASE_LABEL_TOKEN not found');
core.setFailed('PERSONAL_ACCESS_TOKEN not found');
process.exit(1);
}

Expand Down
33 changes: 4 additions & 29 deletions .github/workflows/add-team-label.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Add team label to PR when it is opened
name: Add team label

on:
pull_request:
Expand All @@ -7,31 +7,6 @@ on:

jobs:
add-team-label:
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- run: corepack enable

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # This is needed to checkout all branches

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn

- name: Install dependencies
run: yarn --immutable

- name: Add team label to PR
id: add-team-label-to-pr
env:
RELEASE_LABEL_TOKEN: ${{ secrets.RELEASE_LABEL_TOKEN }}
run: yarn run add-team-label-to-pr
uses: metamask/github-tools/.github/workflows/add-team-label.yml@main
secrets:
itsyoboieltr marked this conversation as resolved.
Show resolved Hide resolved
PERSONAL_ACCESS_TOKEN: ${{ secrets.RELEASE_LABEL_TOKEN }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"deduplicate": "yarn yarn-deduplicate && yarn install",
"set-version": "./scripts/set-versions.sh",
"add-release-label-to-pr-and-linked-issues": "ts-node ./.github/scripts/add-release-label-to-pr-and-linked-issues.ts",
"add-team-label-to-pr": "ts-node ./.github/scripts/add-team-label-to-pr.ts",
"add-team-label": "ts-node ./.github/scripts/add-team-label.ts",
NicolasMassart marked this conversation as resolved.
Show resolved Hide resolved
"run-bitrise-e2e-check": "ts-node ./.github/scripts/bitrise/run-bitrise-e2e-check.ts",
"fitness-functions": "ts-node ./.github/scripts/fitness-functions/index.ts",
"check-pr-has-required-labels": "ts-node ./.github/scripts/check-pr-has-required-labels.ts",
Expand Down Expand Up @@ -583,4 +583,4 @@
}
},
"packageManager": "yarn@1.22.22"
}
}
Loading