Skip to content

Commit

Permalink
updated repo to use team github app (paritytech#41)
Browse files Browse the repository at this point in the history
Now that https://github.com/paritytech/internal_it/issues/205 has been
completed, this change removes my personal access token and replaces it
for the GitHub App.

I also modified very small cosmetics looks in the logs
  • Loading branch information
Bullrich authored Aug 8, 2023
1 parent a36f225 commit b1c2c41
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ jobs:
# as, during development, we change this to use the code from the test branch and
# we may forget to set it back to main
- name: Validate that action points to main branch
if: github.event_name == 'pull_request'
run: |
BRANCH=$(yq '.jobs.review-approvals.steps[0].uses' $FILE_NAME | cut -d "@" -f2)
BRANCH=$(yq '.jobs.review-approvals.steps[1].uses' $FILE_NAME | cut -d "@" -f2)
# If the branch is not the main branch
if [ "$BRANCH" != "$GITHUB_BASE_REF" ]; then
echo "Action points to $BRANCH. It has to point to $GITHUB_BASE_REF instead!"
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/review-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ jobs:
review-approvals:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: team_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.TEAM_APP_ID }}
private_key: ${{ secrets.TEAM_APP_KEY }}
# !This must always point to main.
# Change it for the PRs but remember to change it back
- uses: paritytech/review-bot@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
team-token: ${{ secrets.TEST_TEAM_TOKEN }}
team-token: ${{ steps.team_token.outputs.token }}
1 change: 1 addition & 0 deletions src/github/pullRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export class PullRequestApi {
.addHeading(checkResult.output.title)
// We redirect to the check as it can changed if it is triggered again
.addLink("Find the result here", check.data.html_url ?? "")
.addBreak()
.addRaw(checkResult.output.text)
.write();

Expand Down
5 changes: 3 additions & 2 deletions src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ export class ActionRunner {
}

const { teamsToRequest, usersToRequest } = finalReport;
const validArray = (array: string[] | undefined): boolean => !!array && array.length > 0;
const reviewersLog = [
teamsToRequest ? `Teams: ${JSON.stringify(teamsToRequest)} - ` : "",
usersToRequest ? `Users: ${JSON.stringify(usersToRequest)}` : "",
validArray(teamsToRequest) ? `Teams: ${JSON.stringify(teamsToRequest)}` : "",
validArray(usersToRequest) ? `Users: ${JSON.stringify(usersToRequest)}` : "",
].join(" - ");

this.logger.info(`Need to request reviews from ${reviewersLog}`);
Expand Down

0 comments on commit b1c2c41

Please sign in to comment.