Skip to content

Commit

Permalink
issue #168: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCardin committed Nov 26, 2024
1 parent fd0f6bd commit f9849e5
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/workflow-issue-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,30 @@ jobs:
path: github-workflows

- name: Extract issue number
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_EVENT_ACTION: ${{ github.event.action }}
GITHUB_ISSUE_NUMBER: ${{ github.event.issue.number }}
GITHUB_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
ISSUE_NUMBER=""
if [ "${{ github.event_name }}" == "issues" ] && [ "${{ github.event.action }}" == "opened" ]; then
ISSUE_NUMBER="${{ github.event.issue.number }}"
elif [ "${{ github.event_name }}" == "pull_request" ]; then
echo "test"
ISSUE_NUMBER=$(echo "${{ github.event.pull_request.head.ref }}" | grep -oE '^[0-9]+')
if [ "$GITHUB_EVENT_NAME" == "issues" ] && [ "$GITHUB_EVENT_ACTION" == "opened" ]; then
ISSUE_NUMBER="$GITHUB_ISSUE_NUMBER"
elif [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
BRANCH_NAME="$GITHUB_HEAD_REF"
if [[ "$BRANCH_NAME" =~ ^[0-9]{2,} ]]; then
ISSUE_NUMBER=$(echo "$BRANCH_NAME" | grep -oE '^[0-9]+')
else
echo "1. No issue found. The branch must be created from the issue page so that its name is in the correct format (e.g., 123-my-new-feature)."
echo "2. This pull request was generated by a bot (e.g., Renovate or Dependabot), so it is expected that there isn't an associated issue linked to the pull request branch."
exit 0
fi
fi
echo "test 2"
if [ -n "$ISSUE_NUMBER" ]; then
echo "Issue number '$ISSUE_NUMBER'"
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
else
echo "1. No issue found. The branch must be created from the issue page so that its name is in the correct format (e.g., 123-my-new-feature)."
echo "2. This pull request was generated by a bot (e.g., Renovate or Dependabot), so it is expected that there isn't an associated issue linked to the pull request branch."
fi
- name: Fetch issue project(s) information(s)
Expand Down

0 comments on commit f9849e5

Please sign in to comment.