|
| 1 | +name: Generate infos for PR |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + prnumber: |
| 7 | + description: "send the pullrequest number (optional)" |
| 8 | + default: ${{ github.event.pull_request.number }} |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + secrets: |
| 12 | + token: |
| 13 | + required: true |
| 14 | + outputs: |
| 15 | + pr: |
| 16 | + description: "returns the pullrequest number" |
| 17 | + value: ${{ jobs.generate_infos.outputs.pr }} |
| 18 | + sha: |
| 19 | + description: "returns the sha from pull request" |
| 20 | + value: ${{ jobs.generate_infos.outputs.sha }} |
| 21 | + repo: |
| 22 | + description: "returns the repo name" |
| 23 | + value: ${{ jobs.generate_infos.outputs.repo }} |
| 24 | + owner: |
| 25 | + description: "returns the owner" |
| 26 | + value: ${{ jobs.generate_infos.outputs.owner }} |
| 27 | + sha-short: |
| 28 | + description: "returns the short sha from pull request" |
| 29 | + value: ${{ jobs.generate_infos.outputs.sha-short }} |
| 30 | + version: |
| 31 | + description: "returns the version to build" |
| 32 | + value: ${{ jobs.generate_infos.outputs.version }} |
| 33 | + |
| 34 | +jobs: |
| 35 | + generate_infos: |
| 36 | + runs-on: [ubuntu-latest] |
| 37 | + outputs: |
| 38 | + pr: ${{ steps.tag.outputs.pr }} |
| 39 | + sha: ${{ steps.tag.outputs.sha }} |
| 40 | + repo: ${{ steps.tag.outputs.repo }} |
| 41 | + owner: ${{ steps.tag.outputs.owner }} |
| 42 | + sha-short: ${{ steps.tag.outputs.sha-short }} |
| 43 | + version: ${{ steps.tag.outputs.version }} |
| 44 | + steps: |
| 45 | + - name: Check out the repo |
| 46 | + uses: actions/checkout@v2 |
| 47 | + - name: Setup awesome-ci |
| 48 | + uses: fullstack-devops/awesome-ci-action@main |
| 49 | + |
| 50 | + - name: collect infos |
| 51 | + run: awesome-ci pr info -number ${{ inputs.prnumber }} |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.token }} |
| 54 | + - name: export infos |
| 55 | + id: tag |
| 56 | + shell: bash |
| 57 | + run: | |
| 58 | + echo "::set-output name=version::${ACI_VERSION}-PR-${ACI_PR}-${ACI_PR_SHA_SHORT}" |
| 59 | + echo "::set-output name=pr::$ACI_PR" |
| 60 | + echo "::set-output name=sha::$ACI_PR_SHA" |
| 61 | + echo "::set-output name=sha-short::$ACI_PR_SHA_SHORT" |
| 62 | + echo "::set-output name=owner::$ACI_OWNER" |
| 63 | + echo "::set-output name=repo::$ACI_REPO" |
0 commit comments