diff --git a/.github/ISSUE_TEMPLATE/request-access.md b/.github/ISSUE_TEMPLATE/request-access.md new file mode 100644 index 0000000..3d99464 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-access.md @@ -0,0 +1,15 @@ +--- +name: Request Access +about: Submit this form to request read-only access to a private repository. +title: "[Access Request] Request access for {username}" +labels: access-request +assignees: '' + +--- + +## Request Access to Private Repository + +Thank you for your interest in accessing our private repository! Please fill out the required details below to submit your request. + +### GitHub Username +Please provide your GitHub username. Ensure it's accurate so we can process your request. \ No newline at end of file diff --git a/.github/workflows/private-access.yml b/.github/workflows/private-access.yml new file mode 100644 index 0000000..965a417 --- /dev/null +++ b/.github/workflows/private-access.yml @@ -0,0 +1,27 @@ +name: Process Access Requests + +on: + issues: + types: + - closed + +jobs: + invite-user: + if: contains(github.event.issue.labels.*.name, 'access-request') + runs-on: ubuntu-latest + + steps: + - name: Invite User to Private Repo + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + USERNAME: ${{ github.event.issue.user.login }} + run: | + curl -X PUT \ + -H "Authorization: token $TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/recodehive/Job-Seeker/collaborators/${USERNAME} \ + -d '{"permission": "pull"}' + + - name: Handle Errors + if: failure() + run: echo "An error occurred while processing the request." \ No newline at end of file