fix action
This commit is contained in:
@@ -12,52 +12,54 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
should-deploy: ${{ steps.check-org.outputs.result }}
|
should-deploy: ${{ steps.check-org.outputs.result }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check if bot is mentioned
|
- name: Check if bot is mentioned
|
||||||
id: check-mention
|
id: check-mention
|
||||||
run: |
|
env:
|
||||||
if [[ "${{ github.event.comment.body }}" == *"@github-actions"* ]] || \
|
COMMENT: ${{ github.event.comment.body }}
|
||||||
[[ "${{ github.event.comment.body }}" == *"github-actions[bot]"* ]]; then
|
run: |
|
||||||
bot_mentioned=true
|
if [[ "$TITLE" == *"@github-actions"* ]] || \
|
||||||
else
|
[[ "$TITLE" == *"github-actions[bot]"* ]]; then
|
||||||
bot_mentioned=false
|
bot_mentioned=true
|
||||||
fi
|
else
|
||||||
|
bot_mentioned=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "${{ github.event.comment.body }}" == *"ota"* ]]; then
|
if [[ "${{ github.event.comment.body }}" == *"ota"* ]]; then
|
||||||
has_ota=true
|
has_ota=true
|
||||||
else
|
else
|
||||||
has_ota=false
|
has_ota=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "$bot_mentioned" == "true" ]] && [[ "$has_ota" == "true" ]]; then
|
if [[ "$bot_mentioned" == "true" ]] && [[ "$has_ota" == "true" ]]; then
|
||||||
echo "mentioned=true" >> $GITHUB_OUTPUT
|
echo "mentioned=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "mentioned=false" >> $GITHUB_OUTPUT
|
echo "mentioned=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check organization membership
|
- name: Check organization membership
|
||||||
if: steps.check-mention.outputs.mentioned == 'true'
|
if: steps.check-mention.outputs.mentioned == 'true'
|
||||||
id: check-org
|
id: check-org
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
try {
|
try {
|
||||||
const { data: perm } = await github.rest.repos.getCollaboratorPermissionLevel({
|
const { data: perm } = await github.rest.repos.getCollaboratorPermissionLevel({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
username: context.payload.comment.user.login
|
username: context.payload.comment.user.login
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasAccess = ['admin', 'write'].includes(perm.permission);
|
const hasAccess = ['admin', 'write'].includes(perm.permission);
|
||||||
console.log(`User has ${perm.permission} access`);
|
console.log(`User has ${perm.permission} access`);
|
||||||
|
|
||||||
return hasAccess;
|
return hasAccess;
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
console.log('User has no repository access');
|
console.log('User has no repository access');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle-deploy:
|
bundle-deploy:
|
||||||
name: Bundle and Deploy EAS Update
|
name: Bundle and Deploy EAS Update
|
||||||
|
|||||||
Reference in New Issue
Block a user