@@ -3,7 +3,6 @@ name: Android CI
3
3
on : [push, pull_request, workflow_dispatch]
4
4
5
5
permissions :
6
- pull-requests : write
7
6
contents : read
8
7
actions : read
9
8
@@ -107,64 +106,14 @@ jobs:
107
106
with :
108
107
name : prodDebugAPK
109
108
path : app/build/outputs/apk/prod/debug/app-*.apk
110
-
111
- - name : Comment on PR with APK download links
109
+
110
+ - name : Store Workflow Run ID
112
111
if : github.event_name == 'pull_request'
113
- uses : actions/github-script@v6
112
+ run : echo "${{ github.run_id }}" > run_id.txt
113
+
114
+ - name : Upload Run ID as Artifact
115
+ if : github.event_name == 'pull_request'
116
+ uses : actions/upload-artifact@v4
114
117
with :
115
- github-token : ${{secrets.GITHUB_TOKEN}}
116
- script : |
117
- try {
118
- const token = process.env.GITHUB_TOKEN;
119
- if (!token) {
120
- throw new Error('GITHUB_TOKEN is not set. Please check workflow permissions.');
121
- }
122
-
123
-
124
- const { data: { artifacts } } = await github.rest.actions.listWorkflowRunArtifacts({
125
- owner: context.repo.owner,
126
- repo: context.repo.repo,
127
- run_id: context.runId
128
- });
129
-
130
- if (!artifacts || artifacts.length === 0) {
131
- console.log('No artifacts found for this workflow run.');
132
- return;
133
- }
134
-
135
- const betaArtifact = artifacts.find(artifact => artifact.name === "betaDebugAPK");
136
- const prodArtifact = artifacts.find(artifact => artifact.name === "prodDebugAPK");
137
-
138
- if (!betaArtifact || !prodArtifact) {
139
- console.log('Could not find both Beta and Prod APK artifacts.');
140
- console.log('Available artifacts:', artifacts.map(a => a.name).join(', '));
141
- return;
142
- }
143
-
144
- const betaDownloadUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/suites/${context.runId}/artifacts/${betaArtifact.id}`;
145
- const prodDownloadUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/suites/${context.runId}/artifacts/${prodArtifact.id}`;
146
-
147
- const commentBody = `
148
- 📱 **APK for pull request is ready to see the changes** 📱
149
- - [Download Beta APK](${betaDownloadUrl})
150
- - [Download Prod APK](${prodDownloadUrl})
151
- `;
152
-
153
- await github.rest.issues.createComment({
154
- issue_number: context.issue.number,
155
- owner: context.repo.owner,
156
- repo: context.repo.repo,
157
- body: commentBody
158
- });
159
-
160
- console.log('Successfully posted comment with APK download links');
161
- } catch (error) {
162
- console.error('Error in PR comment creation:', error);
163
- if (error.message.includes('GITHUB_TOKEN')) {
164
- core.setFailed('Missing or invalid GITHUB_TOKEN. Please check repository secrets configuration.');
165
- } else if (error.status === 403) {
166
- core.setFailed('Permission denied. Please check workflow permissions in repository settings.');
167
- } else {
168
- core.setFailed(`Workflow failed : ${error.message}`);
169
- }
170
- }
118
+ name : run-id
119
+ path : run_id.txt
0 commit comments