1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-09 11:52:27 +03:00

github/submodule-update: Let's try github contexts

This commit is contained in:
Athanasius 2022-12-17 11:14:18 +00:00
parent 7df4db50a9
commit c6c1f40429
No known key found for this signature in database
GPG Key ID: 772697E181BB2767

View File

@ -56,29 +56,29 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}" github-token: "${{ secrets.GITHUB_TOKEN }}"
script: | script: |
await github.rest.pulls.create({ await github.rest.pulls.create({
owner: '${process.env.OWNER}', owner: '${{ github.repository_owner }}',
repo: '${process.env.PARENT_REPOSITORY}'.split('/')[1].trim(), repo: '${{ github.repository }}'.split('/')[1].trim(),
head: process.env.GITHUB_RUN_ID, head: process.env.GITHUB_RUN_ID,
base: '${process.env.PR_AGAINST_BRANCH}', base: '${{ github.ref }}',
title: `[Auto-generated] Submodule Updates ${process.env.GITHUB_RUN_ID}`, title: `[Auto-generated] Submodule Updates ${process.env.GITHUB_RUN_ID}`,
body: `[Auto-generated] Submodule Updates ${process.env.GITHUB_RUN_ID}`, body: `[Auto-generated] Submodule Updates ${process.env.GITHUB_RUN_ID}`,
}); });
- name: Add labels # - name: Add labels
if: steps.check_for_changes.outputs.changes == 'true' # if: steps.check_for_changes.outputs.changes == 'true'
uses: actions/github-script@v6 # uses: actions/github-script@v6
with: # with:
github-token: "${{ secrets.GITHUB_TOKEN }}" # github-token: "${{ secrets.GITHUB_TOKEN }}"
script: | # script: |
const res = await github.rest.issues.listForRepo({ # const res = await github.rest.issues.listForRepo({
owner: '${process.env.OWNER}', # owner: '${{ github.repository_owner }}',
repo: '${process.env.PARENT_REPOSITORY}'.split('/')[1].trim(), # repo: '${{ github.repository }}'.split('/')[1].trim(),
}); # });
const pr = res.data.filter(i => i.title.includes(process.env.GITHUB_RUN_ID)); # const pr = res.data.filter(i => i.title.includes(process.env.GITHUB_RUN_ID));
const prNumber = pr[0].number; # const prNumber = pr[0].number;
await github.rest.issues.addLabels({ # await github.rest.issues.addLabels({
issue_number: prNumber, # issue_number: prNumber,
owner: '${process.env.OWNER}', # owner: '${{ github.repository_owner }}',
repo: '${process.env.PARENT_REPOSITORY}'.split('/')[1].trim(), # repo: '${{ github.repository }}'.split('/')[1].trim(),
labels: ['${{ inputs.label }}'] # labels: ['${{ inputs.label }}']
}); # });