Skip to content

Update clone.txt

Update clone.txt #2

Workflow file for this run

name: Pull Request Review Labeler
on:
pull_request:
types: [opened]
jobs:
check_author_team_membership:
runs-on: ubuntu-latest
steps:
- name: Get teams
id: get_teams
uses: octokit/[email protected]
with:
route: GET /orgs/:org/teams
org: ${{ github.event.organization.login }}
headers:
authorization: ${{ secrets.GITHUB_TOKEN }}
- name: Check if author is a member of opsTrack team
id: check_author_membership
run: |
const teams = ${{fromJson(steps.get_teams.outputs.data)}};
const opsTrackTeam = teams.find(team => team.slug === 'opsTrack');
const teamMembers = await github.rest.teams.listMembersInOrg({
org: context.payload.organization.login,
team_slug: opsTrackTeam.slug,
headers: {
authorization: `token ${{ secrets.GITHUB_TOKEN }}`
}
});
const author = context.payload.sender.login;
const isMember = teamMembers.some(member => member.login === author);
if (isMember) {
console.log('Author is a member of opsTrack team');
core.setOutput('opsTrackMember', 'true');
} else {
console.log('Author is not a member of opsTrack team');
core.setOutput('opsTrackMember', 'false');
}
label_pr_needing_reviews:
needs: check_author_team_membership
runs-on: ubuntu-latest
steps:
- name: Check if opsTrack member
run: echo "Author is opsTrack member: ${{ needs.check_author_team_membership.outputs.opsTrackMember }}"

Check failure on line 48 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yml

Invalid workflow file

You have an error in your yaml syntax on line 48
id: opsTrack_member_check
- name: Add label if opsTrack member
if: steps.opsTrack_member_check.outputs.opsTrackMember == 'true'
uses: actions/github-script@v5
with:
script: |
github.issues.addLabels({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
issue_number: context.payload.pull_request.number,
labels: ['codeowner reviews required']
});
script-output: |
{ token: '${{ secrets.GITHUB_TOKEN }}' }